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 435d8c6
Showing 1 changed file with 20 additions and 12 deletions.
32 changes: 20 additions & 12 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,26 +16,34 @@ env:
dependabot: ${{ 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 435d8c6

Please sign in to comment.