Skip to content

Commit

Permalink
[CI/CD] Update pipelines (#22)
Browse files Browse the repository at this point in the history
* Update cd.yml

* Update ci.yml

* Fix exceptions
  • Loading branch information
torbacz authored Aug 29, 2024
1 parent 7b02015 commit 55b550c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
run: dotnet restore

- name: Build
run: dotnet build --no-restore
run: dotnet build --no-restore -c Release

- name: Pack
run: dotnet pack -p:PackageVersion=$PACKAGE_VERSION -c Release
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,17 @@ jobs:

steps:
- uses: actions/checkout@v4

- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x

- name: Restore dependencies
run: dotnet restore

- name: Build
run: dotnet build --no-restore
run: dotnet build --no-restore -c Release

- name: Test
run: dotnet test --no-build --verbosity normal
run: dotnet test --no-build -c Release --verbosity normal
6 changes: 3 additions & 3 deletions src/DependencyUpdated.Repositories.AzureDevOps/AzureDevOps.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public void SwitchToDefaultBranch(string repositoryPath)
logger.Information("Switching {Repository} to branch {Branch}", repositoryPath, branchName);
using var repo = new Repository(repositoryPath);
var branch = repo.Branches[branchName] ??
throw new Exception($"Branch {branchName} doesn't exists");
throw new InvalidOperationException($"Branch {branchName} doesn't exists");

Commands.Checkout(repo, branch);
}
Expand Down Expand Up @@ -102,7 +102,7 @@ public async Task SubmitPullRequest(IReadOnlyCollection<UpdateResult> updates, s

if (result.StatusCode == HttpStatusCode.NonAuthoritativeInformation)
{
throw new Exception("Invalid PAT token provided");
throw new InvalidOperationException("Invalid PAT token provided");
}

var response = await result.Content.ReadAsStringAsync();
Expand All @@ -111,7 +111,7 @@ public async Task SubmitPullRequest(IReadOnlyCollection<UpdateResult> updates, s
PropertyNameCaseInsensitive = true,
};
var responseObject = JsonSerializer.Deserialize<PullRequestResponse>(response, options) ??
throw new Exception("Missing response from API");
throw new InvalidOperationException("Missing response from API");

logger.Information("New PR created {Id}", responseObject.PullRequestId);
if (configValue.AutoComplete)
Expand Down

0 comments on commit 55b550c

Please sign in to comment.