Skip to content

Commit

Permalink
ci(action): prevent duplicate checks on PRs
Browse files Browse the repository at this point in the history
  • Loading branch information
sheerlox committed Nov 17, 2023
1 parent f9927ad commit 57847af
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,15 @@ permissions:
contents: read

jobs:
# ignore the push event trigger if a PR is open for the current branch
prevent-duplicate-checks:
runs-on: ubuntu-latest
steps:
- uses: insurgent-lab/is-in-pr-action@v0.1.3
id: isInPR
outputs:
should-run: ${{ steps.isInPR.outputs.result == 'false' }}

test_matrix:
strategy:
matrix:
Expand All @@ -23,6 +32,9 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 5

needs: prevent-duplicate-checks
if: ${{ needs.prevent-duplicate-checks.outputs.should-run == 'true' }}

steps:
- name: Harden Runner
uses: step-security/harden-runner@eb238b55efaa70779f274895e782ed17c84f2895 # v2.6.1
Expand Down Expand Up @@ -67,7 +79,9 @@ jobs:
sonarcloud:
runs-on: ubuntu-latest
needs:
- prevent-duplicate-checks
- test_matrix
if: ${{ needs.prevent-duplicate-checks.outputs.should-run == 'true' }}
permissions:
pull-requests: read
steps:
Expand Down

0 comments on commit 57847af

Please sign in to comment.