Skip to content

Commit df49d6c

Browse files
authored
Merge branch 'main' into consume-gei-uri-in-multipart-response
2 parents 3ce9bbc + 7345e5c commit df49d6c

17 files changed

+84
-45
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Setup Development Environment
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
paths:
7+
- .github/workflows/copilot-setup-steps.yml
8+
pull_request:
9+
paths:
10+
- .github/workflows/copilot-setup-steps.yml
11+
12+
permissions:
13+
contents: read
14+
15+
jobs:
16+
# The job name MUST be 'copilot-setup-steps' to be picked up by GitHub Copilot
17+
copilot-setup-steps:
18+
runs-on: ubuntu-latest
19+
20+
steps:
21+
- uses: actions/checkout@v4
22+
23+
- name: Setup .NET
24+
uses: actions/setup-dotnet@v2
25+
with:
26+
global-json-file: global.json
27+
28+
- name: Restore dependencies
29+
run: dotnet restore src/OctoshiftCLI.sln

.github/workflows/integration-tests.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,14 @@ on:
66
pr_number:
77
type: number
88
required: true
9+
sha:
10+
type: string
11+
required: true
12+
13+
permissions:
14+
contents: read
15+
checks: write
16+
pull-requests: write
917

1018
jobs:
1119
build-for-e2e-test:
@@ -20,6 +28,19 @@ jobs:
2028
ref: 'refs/pull/${{ github.event.inputs.pr_number }}/merge'
2129
fetch-depth: 0
2230

31+
- name: Check SHA
32+
run: |
33+
git fetch origin refs/pull/${{ github.event.inputs.pr_number }}/head:pr-head
34+
prsha=`git rev-parse pr-head | awk '{ print $1 }'`
35+
36+
echo "PR SHA: $prsha"
37+
echo "expected SHA: ${{ github.event.inputs.SHA }}"
38+
39+
if [ "$prsha" != "${{ github.event.inputs.SHA }}" ]; then
40+
echo "SHA must match" >&2
41+
exit 1
42+
fi
43+
2344
- name: Setup .NET
2445
uses: actions/setup-dotnet@v2
2546
with:
@@ -67,6 +88,7 @@ jobs:
6788
e2e-test:
6889
needs: [ build-for-e2e-test ]
6990
strategy:
91+
fail-fast: false
7092
matrix:
7193
runner-os: [windows-latest, ubuntu-latest, macos-latest]
7294
source-vcs: [AdoBasic, AdoCsv, Bbs, Ghes, Github]

global.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"sdk": {
3-
"version": "8.0.404",
3+
"version": "8.0.410",
44
"rollForward": "minor"
55
}
66
}

src/OctoshiftCLI.Tests/Octoshift/Services/AdoApiTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,7 @@ public async Task AddRepoToBoardsGithubConnection_Should_Send_Correct_Payload()
455455
}
456456
};
457457

458-
await sut.AddRepoToBoardsGithubConnection(ADO_ORG, ADO_TEAM_PROJECT, connectionId, connectionName, endpointId, new List<string>() { ADO_REPO, repo2 });
458+
await sut.AddRepoToBoardsGithubConnection(ADO_ORG, ADO_TEAM_PROJECT, connectionId, connectionName, endpointId, [ADO_REPO, repo2]);
459459

460460
_mockAdoClient.Verify(m => m.PostAsync(endpoint, It.Is<object>(y => y.ToJson() == payload.ToJson())).Result);
461461
}

src/OctoshiftCLI.Tests/Octoshift/Services/CodeScanningAlertServiceTests.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ public async Task MigrateAnalyses_Migrate_Multiple_Analysis()
135135
var processingStatus = new SarifProcessingStatus
136136
{
137137
Status = SarifProcessingStatus.Complete,
138-
Errors = new Collection<string>()
138+
Errors = []
139139
};
140140

141141
_mockSourceGithubApi.Setup(x => x.GetCodeScanningAnalysisForRepository(SOURCE_ORG, SOURCE_REPO, "main")).ReturnsAsync(new[] { analysis1, analysis2 });
@@ -219,7 +219,7 @@ public async Task MigrateAnalyses_Skips_Analysis_That_Exist_On_Target_By_Count()
219219
const string sarifResponse2 = "SARIF_RESPONSE_2";
220220
const string sarifResponse3 = "SARIF_RESPONSE_3";
221221
var processingStatus =
222-
new SarifProcessingStatus { Status = SarifProcessingStatus.Complete, Errors = new Collection<string>() };
222+
new SarifProcessingStatus { Status = SarifProcessingStatus.Complete, Errors = [] };
223223

224224
_mockSourceGithubApi.Setup(x => x.GetCodeScanningAnalysisForRepository(SOURCE_ORG, SOURCE_REPO, "main")).ReturnsAsync(new[] { analysis1, analysis2, analysis3 });
225225
_mockTargetGithubApi.Setup(x => x.GetCodeScanningAnalysisForRepository(TARGET_ORG, TARGET_REPO, "main")).ReturnsAsync(new[] { analysis1 });
@@ -898,7 +898,7 @@ public async Task MigrateAlerts_Skips_An_Analysis_When_SARIF_Report_Not_Found()
898898
var processingStatus = new SarifProcessingStatus
899899
{
900900
Status = SarifProcessingStatus.Complete,
901-
Errors = new Collection<string>()
901+
Errors = []
902902
};
903903

904904
_mockSourceGithubApi.Setup(x => x.GetCodeScanningAnalysisForRepository(SOURCE_ORG, SOURCE_REPO, "main")).ReturnsAsync(new[] { analysis1, analysis2 });

src/OctoshiftCLI.Tests/Octoshift/Services/GithubApiTests.cs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2842,17 +2842,6 @@ async IAsyncEnumerable<JToken> GetAllPages()
28422842
location.Path.Should().Be((string)expectedData["details"]["path"]);
28432843
}
28442844

2845-
private void AssertSecretScanningData(GithubSecretScanningAlert actual, JToken expectedData)
2846-
{
2847-
actual.Number.Should().Be((int)expectedData["number"]);
2848-
actual.State.Should().Be((string)expectedData["state"]);
2849-
actual.SecretType.Should().Be((string)expectedData["secret_type"]);
2850-
actual.Resolution.Should().Be((string)expectedData["resolution"]);
2851-
actual.Secret.Should().Be((string)expectedData["secret"]);
2852-
actual.ResolutionComment.Should().Be((string)expectedData["resolution_comment"]);
2853-
actual.ResolverName.Should().Be((string)expectedData["resolved_by"]["login"]);
2854-
}
2855-
28562845
[Fact]
28572846
public async Task UpdateSecretScanningAlert_Calls_The_Right_Endpoint_With_Payload_For_Resolved_State()
28582847
{

src/OctoshiftCLI.Tests/ado2gh/Commands/GenerateScript/GenerateScriptCommandHandlerTests.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@ public class GenerateScriptCommandHandlerTests
2828
private const string GITHUB_ORG = "GITHUB_ORG";
2929
private const string ADO_SERVER_URL = "http://ado.contoso.com";
3030

31-
private readonly IEnumerable<string> ADO_ORGS = new List<string>() { ADO_ORG };
32-
private readonly IEnumerable<string> ADO_TEAM_PROJECTS = new List<string>() { ADO_TEAM_PROJECT };
33-
private IEnumerable<AdoRepository> ADO_REPOS = new List<AdoRepository> { new() { Name = FOO_REPO } };
34-
private IEnumerable<string> ADO_PIPELINES = new List<string>() { FOO_PIPELINE };
35-
private readonly IEnumerable<string> EMPTY_PIPELINES = new List<string>();
31+
private readonly IEnumerable<string> ADO_ORGS = [ADO_ORG];
32+
private readonly IEnumerable<string> ADO_TEAM_PROJECTS = [ADO_TEAM_PROJECT];
33+
private IEnumerable<AdoRepository> ADO_REPOS = [new() { Name = FOO_REPO }];
34+
private IEnumerable<string> ADO_PIPELINES = [FOO_PIPELINE];
35+
private readonly IEnumerable<string> EMPTY_PIPELINES = [];
3636

3737
private readonly Mock<AdoApi> _mockAdoApi = TestHelpers.CreateMock<AdoApi>();
3838
private readonly Mock<AdoInspectorService> _mockAdoInspector = TestHelpers.CreateMock<AdoInspectorService>();
@@ -326,7 +326,7 @@ public async Task SequentialScript_Skips_Team_Project_With_No_Repos()
326326
public async Task SequentialScript_Single_Repo_Two_Pipelines_All_Options()
327327
{
328328
// Arrange
329-
ADO_PIPELINES = new List<string> { FOO_PIPELINE, BAR_PIPELINE };
329+
ADO_PIPELINES = [FOO_PIPELINE, BAR_PIPELINE];
330330

331331
_mockAdoApi.Setup(m => m.GetTeamProjects(ADO_ORG)).ReturnsAsync(ADO_TEAM_PROJECTS);
332332
_mockAdoApi.Setup(m => m.GetGithubAppId(ADO_ORG, GITHUB_ORG, ADO_TEAM_PROJECTS)).ReturnsAsync(APP_ID);
@@ -374,7 +374,7 @@ public async Task SequentialScript_Single_Repo_Two_Pipelines_All_Options()
374374
public async Task SequentialScript_Single_Repo_Two_Pipelines_No_Service_Connection_All_Options()
375375
{
376376
// Arrange
377-
ADO_PIPELINES = new List<string> { FOO_PIPELINE, BAR_PIPELINE };
377+
ADO_PIPELINES = [FOO_PIPELINE, BAR_PIPELINE];
378378

379379
_mockAdoInspector.Setup(m => m.GetRepoCount()).ReturnsAsync(1);
380380
_mockAdoInspector.Setup(m => m.GetOrgs()).ReturnsAsync(ADO_ORGS);
@@ -874,7 +874,7 @@ public async Task ParallelScript_Skips_Team_Project_With_No_Repos()
874874
public async Task ParallelScript_Two_Repos_Two_Pipelines_All_Options()
875875
{
876876
// Arrange
877-
ADO_REPOS = new List<AdoRepository> { new() { Name = FOO_REPO }, new() { Name = BAR_REPO } };
877+
ADO_REPOS = [new() { Name = FOO_REPO }, new() { Name = BAR_REPO }];
878878

879879
_mockAdoApi.Setup(m => m.GetTeamProjects(ADO_ORG)).ReturnsAsync(ADO_TEAM_PROJECTS);
880880
_mockAdoApi.Setup(m => m.GetGithubAppId(ADO_ORG, GITHUB_ORG, ADO_TEAM_PROJECTS)).ReturnsAsync(APP_ID);
@@ -1031,7 +1031,7 @@ exit 1
10311031
public async Task ParallelScript_Single_Repo_No_Service_Connection_All_Options()
10321032
{
10331033
// Arrange
1034-
ADO_PIPELINES = new List<string> { FOO_PIPELINE, BAR_PIPELINE };
1034+
ADO_PIPELINES = [FOO_PIPELINE, BAR_PIPELINE];
10351035

10361036
_mockAdoApi.Setup(m => m.GetTeamProjects(ADO_ORG)).ReturnsAsync(ADO_TEAM_PROJECTS);
10371037

src/OctoshiftCLI.Tests/ado2gh/Commands/MigrateRepo/MigrateRepoCommandHandlerTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ await _handler.Invoking(async x => await x.Handle(new MigrateRepoCommandArgs
251251
[Fact]
252252
public async Task It_Falls_Back_To_Ado_And_Github_Pats_From_Environment_When_Not_Provided()
253253
{
254-
_mockGithubApi.Setup(x => x.GetRepos(GITHUB_ORG).Result).Returns(new List<(string Name, string Visibility)>());
254+
_mockGithubApi.Setup(x => x.GetRepos(GITHUB_ORG).Result).Returns([]);
255255
_mockGithubApi.Setup(x => x.GetMigration(It.IsAny<string>()).Result).Returns((State: RepositoryMigrationStatus.Succeeded, GITHUB_REPO, 0, null, null));
256256

257257
_mockEnvironmentVariableProvider

src/OctoshiftCLI.Tests/ado2gh/Services/OrgsCsvGeneratorServiceTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public class OrgsCsvGeneratorServiceTests
2121
private readonly Mock<AdoInspectorServiceFactory> _mockAdoInspectorServiceFactory = TestHelpers.CreateMock<AdoInspectorServiceFactory>();
2222

2323
private const string ADO_ORG = "foo-org";
24-
private readonly IEnumerable<string> _adoOrgs = new List<string>() { ADO_ORG };
24+
private readonly IEnumerable<string> _adoOrgs = [ADO_ORG];
2525

2626
private readonly OrgsCsvGeneratorService _service;
2727

src/OctoshiftCLI.Tests/ado2gh/Services/PipelinesCsvGeneratorServiceTests.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@ public class PipelinesCsvGeneratorServiceTests
2020
private readonly Mock<AdoInspectorServiceFactory> _mockAdoInspectorServiceFactory = TestHelpers.CreateMock<AdoInspectorServiceFactory>();
2121

2222
private const string ADO_ORG = "foo-org";
23-
private readonly IEnumerable<string> _adoOrgs = new List<string>() { ADO_ORG };
23+
private readonly IEnumerable<string> _adoOrgs = [ADO_ORG];
2424
private const string ADO_TEAM_PROJECT = "foo-tp";
25-
private readonly IEnumerable<string> _adoTeamProjects = new List<string>() { ADO_TEAM_PROJECT };
25+
private readonly IEnumerable<string> _adoTeamProjects = [ADO_TEAM_PROJECT];
2626
private const string ADO_REPO = "foo-repo";
27-
private readonly IEnumerable<AdoRepository> _adoRepos = new List<AdoRepository> { new() { Name = ADO_REPO } };
27+
private readonly IEnumerable<AdoRepository> _adoRepos = [new() { Name = ADO_REPO }];
2828
private const string ADO_PIPELINE = "foo-pipeline";
29-
private readonly IEnumerable<string> _adoPipelines = new List<string>() { ADO_PIPELINE };
29+
private readonly IEnumerable<string> _adoPipelines = [ADO_PIPELINE];
3030

3131
private readonly PipelinesCsvGeneratorService _service;
3232

0 commit comments

Comments
 (0)