From 72335957b79d666189f91063ce01401c6bd936a6 Mon Sep 17 00:00:00 2001 From: Logicer Date: Sun, 24 Nov 2024 01:07:10 +1100 Subject: [PATCH] skip duplicate CI runs --- .github/workflows/test.yml | 34 +++++++++++++++++++++------------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a4d53c0..81aef5b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -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 @@ -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