Skip to content

Avoid re-running wokflow for the same commit #27031

Answered by shrink
amezin asked this question in Actions
Discussion options

You must be logged in to vote

Yes, you can use the Check Runs API to identify Workflow runs for a ref. As luck would have it, someone has already built a comprehensive Action for this use-case: fkirc/skip-duplicate-actions.

  1. Add a new “pre” job to your Workflow, this job uses fkirc/skip-duplicate-actions to determine if your main job should be skipped
  2. Add a condition to your main job using the should_skip output of the “pre” job.

For example, adapted from the fkirc/skip-duplicate-actions readme:

jobs:
  pre_job:
    runs-on: ubuntu-latest
    outputs:
      should_skip: ${{ steps.skip_check.outputs.should_skip }}
    steps:
      - id: skip_check
        uses: fkirc/skip-duplicate-actions@v3.4.0
        with:
       …

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
3 participants