@@ -73,21 +73,14 @@ jobs:
73
73
name : ${{ matrix.name }}
74
74
jobs : ${{ toJSON(fromJSON(needs.build-workflow.outputs.workflow)[matrix.name]) }}
75
75
76
- verify-devcontainers :
77
- name : Verify Dev Containers
78
- permissions :
79
- id-token : write
80
- contents : read
81
- uses : ./.github/workflows/verify-devcontainers.yml
82
-
83
- # Check all other job statuses. This job gates branch protection checks.
84
- ci :
85
- name : CI
76
+ # This job acts as a sentry and will fail if any leaf job in the workflow tree fails, as
77
+ # run-workflow always succeeds. Use this job when checking for successful matrix workflow job completion.
78
+ verify-workflow :
79
+ name : Verify and summarize workflow results
86
80
if : ${{ always() && !cancelled() }}
87
81
needs :
88
82
- build-workflow
89
83
- run-workflow
90
- - verify-devcontainers
91
84
permissions :
92
85
contents : read
93
86
pull-requests : write # Posts a comment back to the PR.
@@ -107,6 +100,26 @@ jobs:
107
100
github_token : ${{ secrets.GITHUB_TOKEN }}
108
101
pr_number : ${{ fromJSON(steps.get-pr-info.outputs.pr-info).number }}
109
102
103
+ verify-devcontainers :
104
+ name : Verify Dev Containers
105
+ permissions :
106
+ id-token : write
107
+ contents : read
108
+ uses : ./.github/workflows/verify-devcontainers.yml
109
+
110
+ # Check all other job statuses. This job gates branch protection checks.
111
+ ci :
112
+ name : CI
113
+ # !! Important: This job is used for branch protection checks.
114
+ # !! Need to use always() instead of !cancelled() because skipped jobs count as success
115
+ # !! for Github branch protection checks. Yes, really: by default, branch protections
116
+ # !! can be bypassed by cancelling CI. See NVIDIA/cccl#605.
117
+ if : ${{ always() }}
118
+ needs :
119
+ - verify-workflow
120
+ - verify-devcontainers
121
+ runs-on : ubuntu-latest
122
+ steps :
110
123
- name : Check results
111
124
run : |
112
125
status="passed"
@@ -124,11 +137,9 @@ jobs:
124
137
fi
125
138
}
126
139
127
- # Note that run-workflow is different:
128
- check_result "build-workflow" "success" "${{needs.build-workflow.result}}"
129
- check_result "run-workflow" "true" "${{steps.check-workflow.outputs.success}}"
140
+ check_result "verify-workflow" "success" "${{needs.verify-workflow.result}}"
130
141
check_result "verify-devcontainers" "success" "${{needs.verify-devcontainers.result}}"
131
142
132
- if [[ "$status" == "failed " ]]; then
143
+ if [[ "$status" != "success " ]]; then
133
144
exit 1
134
145
fi
0 commit comments