From aa159fd8eeefafeb69d95a145cda54997420a69c Mon Sep 17 00:00:00 2001 From: Bernhard Kirchen Date: Fri, 27 Sep 2024 20:34:17 +0200 Subject: [PATCH] prevent actions from running twice when pushing to PRs --- .github/workflows/cpplint.yml | 5 +++-- .github/workflows/yarnlint.yml | 5 +++-- .github/workflows/yarnprettier.yml | 5 +++-- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/.github/workflows/cpplint.yml b/.github/workflows/cpplint.yml index 6ea139dfb..f8d6847ab 100644 --- a/.github/workflows/cpplint.yml +++ b/.github/workflows/cpplint.yml @@ -6,8 +6,9 @@ jobs: build: runs-on: ubuntu-latest - # prevent push event from triggering if it's part of a PR - if: github.event_name != 'push' || github.event.pull_request == null + # prevent push event from triggering if it's part of a local PR, see + # https://github.com/orgs/community/discussions/57827#discussioncomment-6579237 + if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/yarnlint.yml b/.github/workflows/yarnlint.yml index 165235ff7..229a93db3 100644 --- a/.github/workflows/yarnlint.yml +++ b/.github/workflows/yarnlint.yml @@ -6,8 +6,9 @@ jobs: build: runs-on: ubuntu-latest - # prevent push event from triggering if it's part of a PR - if: github.event_name != 'push' || github.event.pull_request == null + # prevent push event from triggering if it's part of a local PR, see + # https://github.com/orgs/community/discussions/57827#discussioncomment-6579237 + if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name defaults: run: diff --git a/.github/workflows/yarnprettier.yml b/.github/workflows/yarnprettier.yml index d288c8b90..260a19ba5 100644 --- a/.github/workflows/yarnprettier.yml +++ b/.github/workflows/yarnprettier.yml @@ -6,8 +6,9 @@ jobs: build: runs-on: ubuntu-latest - # prevent push event from triggering if it's part of a PR - if: github.event_name != 'push' || github.event.pull_request == null + # prevent push event from triggering if it's part of a local PR, see + # https://github.com/orgs/community/discussions/57827#discussioncomment-6579237 + if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name defaults: run: