How do I re-run Github Actions?
There are two situations:
1) On a failed build, from the docs
Optionally, if the run failed, to re-run the workflow, in the upper-right corner of the workflow, use the Re-run checks drop-down menu, and select Re-run all checks.
2) If your run did not fail, you have to trigger the event which your workflow runs on:
.
In the most usual case of on: push
, you can add an empty commit to poke GitHub actions:
git commit --allow-empty -m "trigger GitHub actions"
git push
This will add an empty commit (no files changed), and will trigger another push
event on GitHub, and therefore trigger another workflow run.
This does, however, muck up the commit history. You can later squash/remove these if you like, but it's perhaps not ideal.
This is an update to my original answer, which referred to GitHub Actions HCL-based v1, prior to the August 2019 YAML-based re-release. @tuff got this right first, with @instantepiphany‘s caveat.
You can also now (January 2020) use the new GitHub Actions API(!, still beta though), as announced here.
And it does include a GitHub Actions Secrets API:
Re-run a workflow
Re-runs your workflow run using its id.
Anyone with write access to the repository can use this endpoint.
GitHub Apps must have the actions permission to use this endpoint.POST /repos/:owner/:repo/actions/runs/:run_id/rerun
So you can try and script and get an Actions workflow rerun through this new API.
ken notes in the comments (July 2022):
Only able to re-run a workflow ran within a month.
Any workflow ran on more than 30 days cannot be re-run.
Tested it Jun 2022.
Since July 2022, you can differente triggering actor from executing actor.