Skip to content

Commit

Permalink
build: refactor check-test job for ci.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
modesty committed Apr 29, 2024
1 parent 5df02f0 commit 88f3776
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,16 @@ jobs:
id: test
run: npm test

- name: Require tests to pass
if: ${{ always() }}
uses: actions/github-script@v6
check-tests:
needs: build # Depends on the 'build' job
runs-on: ubuntu-latest
if: ${{ always() }}
steps:
- uses: actions/github-script@v6
with:
script: |
console.log('Exit code:', core.getInput('result'));
if (core.getInput('result') !== '0') {
core.setFailed('Tests failed. Please fix errors before merging.');
if (needs.build.outputs.test-result !== '0') {
core.setFailed('Tests failed - ' + needs.build.outputs.test-result + '. Please fix errors before merging.');
}
result: ${{ jobs.build.outputs.test-result }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit 88f3776

Please sign in to comment.