I have two separate workflows. One for testing and one for deploying. The deploy workflow should only run if the test workflow completes succesfully
Test workflow
name: run-tests
on:
release:
types: [published]
jobs:
....do stuff
Deploy workflow
name: deploy
on:
workflow_run:
workflows: ["run-tests"]
branches: [main]
types:
- completed
jobs:
deploy:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
According to Github Actions docs and several Stack Overflow questions that is how it should be done. However, that doesn't work. The problem is that when I create a new release on Github, it triggers the first test workflow, but the name of the workflow is the name of the release tag .i.e v1.2.3
!
The workflows will run correctly if I set a manual trigger on the test workflow and run it manually. Then the workflow will get the name run-tests
and the trigger for the deploy works.
How can I make the delpoy workflow trigger to work also when the test workflow is triggered by a new release?
Coming back to this old question as it is still unanswered. The key here was to know that one can not chain workflows with workflow_run
unless the first workflow is triggered either by push or pull_request events or unless the first workflow is manually triggered.
So basically one can't chain the workflows, if the first workflow is triggered by release event.