@@ -143,7 +143,7 @@ jobs:
143143 repository : ${{ github.event.client_payload.github.payload.repository.full_name }}
144144 token : ${{ secrets.PULUMI_BOT_TOKEN }}
145145 lint :
146- container : golangci/golangci-lint:v1.51
146+ container : golangci/golangci-lint:v1.54.1
147147 if : github.event_name == 'repository_dispatch' ||
148148 github.event.pull_request.head.repo.full_name == github.repository
149149 name : lint
@@ -260,16 +260,43 @@ jobs:
260260 fields : repo,commit,author,action
261261 status : ${{ job.status }}
262262 sentinel :
263- if : github.event_name == 'repository_dispatch' ||
264- github.event.pull_request.head.repo.full_name == github.repository
265263 name : sentinel
264+ # We would like to be able to specify `sentinel` as the only required job for this
265+ # workflow. To do that, we need `sentinel` to succeed only when it is safe to
266+ # merge and fail in all other cases.
267+ #
268+ # We can't use the default `if: success()`, since GitHub interprets a skipped job as a
269+ # success, and by default a dependee job failing will skip a dependent job. That means
270+ # if a test step fails, then it will skip `sentinel` so GitHub will register
271+ # `sentinel` as succeeded.
272+ #
273+ # GitHub documents `jobs.result` as:
274+ #
275+ # The result of a job in the reusable workflow. Possible values are success,
276+ # failure, cancelled, or skipped.
277+ #
278+ # GitHub documents `cancelled()` as:
279+ #
280+ # Returns true if the workflow was canceled.
281+ #
282+ # Combining these terms gives us an intuitive definition of success:
283+ #
284+ # We have succeeded when no dependent workflow has failed and the job was
285+ # not cancelled.
286+ #
287+ if : (github.event_name == 'repository_dispatch' ||
288+ github.event.pull_request.head.repo.full_name == github.repository) &&
289+ ! cancelled()
266290 needs :
267291 - test
268292 - lint
269293 runs-on : ubuntu-latest
270294 steps :
271- - name : Is workflow a success
272- run : echo yes
295+ - name : Workflow is not a success
296+ if : contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') || contains(needs.*.result, 'skipped')
297+ run : exit 1
298+ - name : Workflow is a success
299+ run : echo "πππππ"
273300 test :
274301 if : github.event_name == 'repository_dispatch' ||
275302 github.event.pull_request.head.repo.full_name == github.repository
0 commit comments