Skip to content

Commit

Permalink
Merge pull request #3239 from Azure/anthony-c-martin-patch-2
Browse files Browse the repository at this point in the history
Set exit code on failure
  • Loading branch information
anthony-c-martin authored Oct 17, 2024
2 parents b752c08 + 3885574 commit 839d3b9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/generate-schemas.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ jobs:

- name: Run generator
run: |
set -e
rm -Rf "$GITHUB_WORKSPACE/schemas"
rm -Rf "$GITHUB_WORKSPACE/summary.log"
mkdir -p "$GITHUB_WORKSPACE/schemas"
Expand All @@ -69,6 +70,9 @@ jobs:
--combine-batch-mode true
working-directory: generator

- name: Print summary
run: cat summary.log

- name: Upload Schemas
uses: actions/upload-artifact@v4
with:
Expand Down Expand Up @@ -125,4 +129,4 @@ jobs:
commit_message: Update Generated Schemas
branch: autogenerate-batch
push_options: '--force'
create_branch: true
create_branch: true
6 changes: 5 additions & 1 deletion generator/cmd/generateall.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,9 @@ executeSynchronous(async () => {
pkg.result = 'failed';
console.log(colors.red(`Caught exception processing autogenlist entry ${autoGenConfig.basePath}.`));
console.log(colors.red(`${(error as Error)?.stack || error}`));


// return a non-zero exit code to mark the process as failed
process.exitCode = 1;
// Use markdown formatting as this summary will be included in the PR description
logOut(summaryLogger,
`<details>
Expand All @@ -118,6 +120,8 @@ executeSynchronous(async () => {
packages.push(pkg);
}
} catch (error) {
// return a non-zero exit code to mark the process as failed
process.exitCode = 1;
// Use markdown formatting as this summary will be included in the PR description
// This error usually indicates that a file has not been found (readme)
logOut(summaryLogger,
Expand Down

0 comments on commit 839d3b9

Please sign in to comment.