Skip to content

A GitHub App that re-runs Action Workflows via PR comment commands.

License

Notifications You must be signed in to change notification settings

estroz/rerun-actions

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rerun-actions

A GitHub Action that re-runs other Action Workflows via PR comment commands.

How it works

Once a PR is submitted against a repo with GitHub Actions enabled, a workflow will run. If that workflow fails, it can be rerun by POST-ing to the Actions API. rerun-actions reruns workflows by parsing the body of a PR comment (specified by the comment's id retrieved from an issue_comment webhook event) for certain commands and rerunning jobs matching those commands.

Some notes:

  • The PR either must have an ok-to-test label present on the PR, or the user who writes a command must be an organization member, or repo owner, contributor, or collaborator.
    • Typically ok-to-test can/should only be applied by repo reviewers/approvers to prevent spam and abuse.
  • rerun-actions should only be run on comment creation. See the below examples for how to do this.

Comment commands

The following commands are supported by this action:

  • /rerun-all - rerun all failed workflows.
  • /rerun-workflow <workflow name> - rerun a specific failed workflow. Only one workflow name can be specified. Multiple /rerun-workflow commands are allowed per comment.

Note: Only failed workflows can be rerun due to limitations in the Github Actions API.

Examples

Example workflow file (use this config verbatim):

on:
  issue_comment:
    types: [created]

jobs:
  rerun_pr_tests:
    name: rerun_pr_tests
    if: ${{ github.event.issue.pull_request }}
    runs-on: ubuntu-20.04
    steps:
    - uses: estroz/rerun-actions@main
      with:
        repo_token: ${{ secrets.GITHUB_TOKEN }}
        comment_id: ${{ github.event.comment.id }}

About

A GitHub App that re-runs Action Workflows via PR comment commands.

Resources

License

Stars

Watchers

Forks

Packages

No packages published