Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions template/.github/workflows/ci.yml.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -56,17 +56,28 @@ jobs:
set -e
test $STATUS -eq 0 -o $STATUS -eq 5

# Sentinel job — use this as the single required status check in branch protection.
# Sentinel job — the single required status check in the master ruleset. A job
# counts only when it succeeded: "skipped" means the work did not happen. A job
# skipped by design (one that runs on pull requests only, say) goes in MAY_SKIP
# by its job id, and only those may end skipped.
all-checks-passed:
name: All checks passed
if: always()
needs: [lint, test-unit, test-integration]
runs-on: ubuntu-latest
steps:
- name: Check all jobs succeeded
env:
NEEDS: ${% raw %}{{ toJSON(needs) }}{% endraw %}
MAY_SKIP: '[]'
run: |
if [[ "${% raw %}{{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') }}{% endraw %}" == "true" ]]; then
echo "One or more required checks failed."
NOT_PASSED=$(jq -r --argjson skip "$MAY_SKIP" '
to_entries[]
| select((.value.result == "success" or (.value.result == "skipped" and (.key | IN($skip[])))) | not)
| "\(.key): \(.value.result)"' <<< "$NEEDS")
if [ -n "$NOT_PASSED" ]; then
echo "Not passed:"
echo "$NOT_PASSED"
exit 1
fi
echo "All checks passed."
Loading