From ceec6ca75d8c9500c0bbe03ef303f566829cf1c8 Mon Sep 17 00:00:00 2001 From: Kenta Moriuchi Date: Wed, 22 Dec 2021 10:31:53 +0900 Subject: [PATCH] Update to cancel heavy CI if not needed --- .github/workflows/codeql-analysis.yml | 6 +++++- .github/workflows/test.yml | 7 +++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 468f7931..b5da50d1 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -11,12 +11,16 @@ on: - master permissions: - actions: read + actions: write contents: read security-events: write jobs: analyze: + - if: github.actor == 'dependabot[bot]' + name: Cancel in case of dependencies update + uses: andymckay/cancel-action@0.2 + name: Analyze runs-on: ubuntu-latest if: | diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 4fc62f1e..ab06b413 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -11,6 +11,7 @@ on: - master permissions: + actions: write contents: read jobs: @@ -91,6 +92,12 @@ jobs: name: Check PR actor run: exit 1 + - if: | + github.actor == 'dependabot[bot]' && + (contains(github.head_ref, 'types/') || contains(github.head_ref, 'eslint') || contains(github.head_ref, 'find-unused-exports') || contains(github.head_ref, 'concurrently')) + name: Check PR dependencies in case of Dependabot actor + uses: andymckay/cancel-action@0.2 + - if: github.event_name != 'pull_request_target' uses: actions/checkout@v2 with: