Skip to content
repeat

GitHub Action

Re-run Workflow

v1.5.0 Latest version

Re-run Workflow

repeat

Re-run Workflow

Re-run a workflow once or continuously until it succeeds by applying (or removing) labels to a pull request.

Installation

Copy and paste the following snippet into your .yml file.

              

- name: Re-run Workflow

uses: reitermarkus/rerun-workflow@v1.5.0

Learn more about this action in reitermarkus/rerun-workflow

Choose a version

CI Status

Re-run Workflow Action

This action allows re-running a workflow when labels are added to (or removed from) a pull request.

Inputs

Name Required Description
token yes A GitHub Token other than the default GITHUB_TOKEN needs to be specified in order to be able to re-run workflows.
once-label no1 When this label is added to a pull request, re-run the workflow once and remove the label again.
continuous-label no1 When this label is added to a pull request, continuously re-run the workflow until it succeeds or is cancelled. The action needs to be run on workflow_run, push or schedule events for this to work.
trigger-labels no1 When any of the labels in this comma-separated list is added to or removed from a pull request, re-run the workflow once.
failed-jobs-only no Specify whether only failed jobs should be re-run.
workflow yes File name or ID of the workflow which should be re-run.

1 At least one of once-label, continuous-label or trigger-labels is required.

Example Workflow

name: Re-run Workflow

on:
  # Check open pull requests for relevant labels and re-run the
  # corresponding workflows if necessary.
  # (Only recommended for testing.)
  push:

  # Check open pull requests for relevant labels and re-run the
  # corresponding workflows if necessary.
  schedule:
    - cron: '*/30 * * * *'

  # Remove relevant labels when a pull request is closed or trigger
  # a re-run when a relevant labels ia added or removed.
  pull_request_target:
    types:
      - closed
      - labeled
      - unlabeled

  # Check open pull requests for relevant labels and re-run the
  # corresponding workflows if necessary.
  workflow_dispatch:

  # Remove relevant labels when a workflow run finishes successfully.
  workflow_run:
    workflows:
      - CI
    types:
      - completed

jobs:
  rerun-workflow:
    runs-on: ubuntu-latest
    steps:
      - name: Re-run pull request workflows
        uses: reitermarkus/rerun-workflow@v1
        with:
          token: ${{ secrets.MY_GITHUB_TOKEN }}
          once-label: ci-requeue
          continuous-label: ci-retry
          trigger-labels: ci-trigger-1,ci-trigger-2
          failed-jobs-only: false
          workflow: ci.yml