Skip to content

Commit

Permalink
chore(actions): add ci job for branch protection (#12524)
Browse files Browse the repository at this point in the history
* chore(actions): add ci job for branch protection

* Update .github/workflows/pr.yml

---------

Co-authored-by: Ashwin Kumar <[email protected]>
Co-authored-by: Jim Blanchard <[email protected]>
  • Loading branch information
3 people authored Nov 10, 2023
1 parent 51ed7b4 commit 414da5a
Showing 1 changed file with 25 additions and 5 deletions.
30 changes: 25 additions & 5 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,29 @@ jobs:
- github-actions-test
- tsc-compliance-test
runs-on: ubuntu-latest
# This is a bit of a hack - Branch protections depend upon selected
# workflows that run on hardware, not parents of many callable workflows.
# Adding this so that unit and bundle checks can be a single protection line.
if: success() # only run when all checks have passed
# store success output flag for ci job
outputs:
success: ${{ steps.setoutput.outputs.success }}
steps:
- name: All tests passed
run: echo "All tests passed"
- id: setoutput
run: echo "::set-output name=success::true"
ci:
runs-on: ubuntu-latest
if: always() # always run, so we never skip the check
name: ci - Unit and Bundle tests have passed
needs: all-unit-tests-pass
env:
PASSED: ${{ needs.all-unit-tests-pass.outputs.success }}
steps:
# this job passes only when output of all-unit-tests-pass job is set
# in case at least one of the checks fails, all-unit-tests-pass is skipped
# and the output will not be set, which will then cause the ci job to fail
- run: |
if [[ $PASSED == "true" ]]; then
echo "All checks have passed"
exit 0
else
echo "One or more checks have failed"
exit 1
fi

0 comments on commit 414da5a

Please sign in to comment.