Skip to content

Commit

Permalink
skip duplicate CI runs
Browse files Browse the repository at this point in the history
  • Loading branch information
Logicer16 committed Nov 23, 2024
1 parent 74057ca commit 7233595
Showing 1 changed file with 21 additions and 13 deletions.
34 changes: 21 additions & 13 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,29 +13,37 @@ on:

env:
report: ${{ github.event_name != 'workflow_call' || inputs.report }}
dependabot: ${{ github.event.pull_request.user.login == 'dependabot[bot]' }}
dependabot: ${{ github.event_name == 'pull_request' && github.event.pull_request.user.login == 'dependabot[bot]' }}

jobs:
GenerateMatrix:
Prepare:
runs-on: ubuntu-latest

outputs:
node-version: ${{ steps.create-node-matrix.outputs.matrix }}
matrix: ${{ steps.create-matrix.outputs.matrix }}
should-skip: ${{ steps.skip-check.outputs.should_skip }}

steps:
- name: Create Node Version Matrix
id: create-node-matrix
- name: Create Matrix
id: create-matrix
run: |
NODE_VERSIONS="['20.x']"
echo "matrix=$NODE_VERSIONS" >> "$GITHUB_OUTPUT"
MATRIX="{'node-version':['20.x']}"
echo "matrix=$MATRIX" >> "$GITHUB_OUTPUT"
- id: skip-check
uses: fkirc/skip-duplicate-actions@v5
with:
concurrent_skipping: "same_content_newer"
skip_after_successful_duplicate: "true"
do_not_skip: '["pull_request", "workflow_dispatch", "schedule"]'

Style:
runs-on: ubuntu-latest

needs: [GenerateMatrix]
needs: [Prepare]
if: needs.Prepare.outputs.should-skip != 'true'
strategy:
matrix:
node-version: ${{ fromJson(needs.GenerateMatrix.outputs.node-version) }}
matrix: ${{ fromJson(needs.Prepare.outputs.matrix) }}

permissions:
checks: write
Expand Down Expand Up @@ -77,10 +85,10 @@ jobs:
Test:
runs-on: ubuntu-latest

needs: [GenerateMatrix]
needs: [Prepare]
if: needs.Prepare.outputs.should-skip != 'true'
strategy:
matrix:
node-version: ${{ fromJson(needs.GenerateMatrix.outputs.node-version) }}
matrix: ${{ fromJson(needs.Prepare.outputs.matrix) }}

permissions:
checks: write
Expand Down

0 comments on commit 7233595

Please sign in to comment.