Make workflow runs run consecutively.
Create a comment here and delete it immediately and then go to the Actions tab to see how the second workflow run waits for the previous one.
jobs:
consecutiveness:
runs-on: ubuntu-latest
steps:
- uses: mktcode/consecutive-workflow-action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
# your other jobs
something:
runs-on: ubuntu-latest
needs: [ consecutiveness ]
steps:
# ...
The token is needed to avoid rate limitation issues when performing API calls. I was thinking about making that optional but decided to just make you aware of the security risk and how to avoid it.
Please read this section in the docs before using some random action that asks for your secrets.
There is a v1
branch and tag for this action and you can simply decide to trust me. I recommend using a commit hash instead though.
- uses: mktcode/consecutive-workflow-action@cb3605cc3ab767c170434b0cfb6b522d193b7d57
Review the repo at this commit.
I also found these actions, which might better suit your needs:
- https://github.com/lewagon/wait-on-check-action
- https://github.com/fountainhead/action-wait-for-check
Their purpose is slightly different. You can wait for certain checks to pass and therefore you can specify a certain ref and you can wait for runs of different workflows.
My action does only one thing: It forces runs of the same workflow to run in consecutive order.
I needed this because I let my workflows push to the repo a lot, which fails when one run pushes in between checkout and push in another run.