Skip to content

Commit 414da5a

Browse files
ashwinkumar6Ashwin Kumarjimblanc
authored
chore(actions): add ci job for branch protection (#12524)
* 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]>
1 parent 51ed7b4 commit 414da5a

File tree

1 file changed

+25
-5
lines changed

1 file changed

+25
-5
lines changed

.github/workflows/pr.yml

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,29 @@ jobs:
4545
- github-actions-test
4646
- tsc-compliance-test
4747
runs-on: ubuntu-latest
48-
# This is a bit of a hack - Branch protections depend upon selected
49-
# workflows that run on hardware, not parents of many callable workflows.
50-
# Adding this so that unit and bundle checks can be a single protection line.
48+
if: success() # only run when all checks have passed
49+
# store success output flag for ci job
50+
outputs:
51+
success: ${{ steps.setoutput.outputs.success }}
5152
steps:
52-
- name: All tests passed
53-
run: echo "All tests passed"
53+
- id: setoutput
54+
run: echo "::set-output name=success::true"
55+
ci:
56+
runs-on: ubuntu-latest
57+
if: always() # always run, so we never skip the check
58+
name: ci - Unit and Bundle tests have passed
59+
needs: all-unit-tests-pass
60+
env:
61+
PASSED: ${{ needs.all-unit-tests-pass.outputs.success }}
62+
steps:
63+
# this job passes only when output of all-unit-tests-pass job is set
64+
# in case at least one of the checks fails, all-unit-tests-pass is skipped
65+
# and the output will not be set, which will then cause the ci job to fail
66+
- run: |
67+
if [[ $PASSED == "true" ]]; then
68+
echo "All checks have passed"
69+
exit 0
70+
else
71+
echo "One or more checks have failed"
72+
exit 1
73+
fi

0 commit comments

Comments
 (0)