How do I re-run Github Actions?

tuff picture tuff · Jun 4, 2019 · Viewed 13.3k times · Source

I see this on the Github web UI:

screenshot

but it's not clear to me whether the disabled re-runs are a result of my .github/main.workflow configuration, or inherited from the Github Actions service.

Sample workflow below - I don't see anything obvious there that would disable re-runs.

workflow "Test, Lint" {
  on = "push"
  resolves = [
    "Test",
    "Lint",
    "Lint Format"
  ]
}

action "Install" {
  uses = "actions/npm@master"
  args = "install"
  secrets = ["SECRET_TOKEN"]
}

action "Test" {
  needs = "Install"
  uses = "actions/npm@master"
  args = "test"
  secrets = ["SECRET_TOKEN"]
}

action "Lint" {
  needs = "Install"
  uses = "actions/npm@master"
  args = "run lint"
  secrets = ["SECRET_TOKEN"]
}

action "Lint Format" {
  needs = "Install"
  uses = "actions/npm@master"
  args = "run lint:format"
  secrets = ["SECRET_TOKEN"]
}

Answer

maxheld picture maxheld · Jun 20, 2019

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. rerun

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.