Skip to content

Commit

Permalink
Test sentinel
Browse files Browse the repository at this point in the history
  • Loading branch information
iwahbe committed Sep 1, 2023
1 parent db0986b commit 9eb6365
Showing 1 changed file with 31 additions and 4 deletions.
35 changes: 31 additions & 4 deletions .github/workflows/run-acceptance-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -260,16 +260,43 @@ jobs:
fields: repo,commit,author,action
status: ${{ job.status }}
sentinel:
if: github.event_name == 'repository_dispatch' ||
github.event.pull_request.head.repo.full_name == github.repository
name: sentinel
# We would like to be able to specify `sentinel` as the only required job for this
# workflow. To do that, we need `sentinel` to succeed only when it is safe to
# merge and fail in all other cases.
#
# We can't use the default `if: success()`, since GitHub interprets a skipped job as a
# success, and by default a dependee job failing will skip a dependent job. That means
# if a test step fails, then it will skip `sentinel` so GitHub will register
# `sentinel` as succeeded.
#
# GitHub documents `failure()` as:
#
# Returns true when any previous step of a job fails. If you have a chain of
# dependent jobs, failure() returns true if any ancestor job fails.
#
# GitHub documents `cancelled()` as:
#
# Returns true if the workflow was canceled.
#
# Combining these terms gives us an intuitive definition of success:
#
# We have succeeded when no dependent workflow has failed and the job was
# not cancelled.
#
if: (github.event_name == 'repository_dispatch' ||
github.event.pull_request.head.repo.full_name == github.repository) &&
! cancelled()
needs:
- test
- lint
runs-on: ubuntu-latest
steps:
- name: Is workflow a success
run: echo yes
- name: Workflow is not a success
if: failure()
run: exit 1
- name: Workflow is a success
run: echo "🎉🎉🎉"
test:
if: github.event_name == 'repository_dispatch' ||
github.event.pull_request.head.repo.full_name == github.repository
Expand Down

0 comments on commit 9eb6365

Please sign in to comment.