GitHub Action
Workflow Run Wait
wait for all workflow_run
required workflows to be successful
Why?
The workflow_run
event occurs when a workflow run is requested or completed, and allows you to execute a workflow based on the finished result of another workflow.
on:
workflow_run:
workflows: [ test ]
types:
- completed
However by itself, this doesn't quite work as expected.
-
The
completed
type, does not indicate success, for that you'd have to include the following in each job of your workflow:if: ${{ github.event.workflow_run.conclusion == 'success' }}
-
If you're depending on more than one workflow, then ANY of them completing, will trigger the event
name: deploy on: workflow_run: workflows: [ test, lint, compile ] types: - completed
if your
test
workflow fails, butlint
completed successfully,github.event.workflow_run.conclusion == 'success'
will still be true -
Your workflow will trigger as many times as you have workflow dependencies
in the previous example, our
deploy
workflow, will run 3 times!
All this makes the workflow_run
event fundamentally broken for any advanced usage, this Action aims to remedy that.
Note: See this Community discussion for more info on the topic
on:
workflow_run:
workflows: [ test-client, test-server ]
branches: [ master ]
types: [ completed ]
jobs:
xyz:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: ahmadnassri/action-workflow-run-wait@v1
# only runs additional steps if [ test-client, test-server ] were successful
input | required | default | description |
---|---|---|---|
github-token |
❌ | github.token |
The GitHub token used to call the GitHub API |
timeout |
❌ | 30000 |
timeout before we stop trying (in milliseconds) |
delay |
❌ | 5000 |
delay between status checks (in milliseconds) |
Author: Ahmad Nassri • Twitter: @AhmadNassri