From: Richard Si <63936253+ichard26@users.noreply.github.com> Date: Sun, 14 Feb 2021 15:23:47 +0000 (-0500) Subject: Fix duplication of checks on internal PRs (#1986) X-Git-Url: https://git.madduck.net/etc/vim.git/commitdiff_plain/76268ab0c9b4e4d030b2d16272bfbdcad5172aad?ds=inline;hp=b8c1020b526b488a1a216d9a4d58fc8616b61a99 Fix duplication of checks on internal PRs (#1986) Internal PRs (that come from branches of psf/black) match both the push and pull_request events. This leads to a duplication of test, lint, etc. checks on such PRs. Not only is it a waste of resources, it makes the Status Checks UI more frustrating to go through. Patch taken from: https://github.community/t/duplicate-checks-on-push-and-pull-request-simultaneous-event/18012 --- diff --git a/.github/workflows/doc.yml b/.github/workflows/doc.yml index d266e55..930b6d4 100644 --- a/.github/workflows/doc.yml +++ b/.github/workflows/doc.yml @@ -16,8 +16,14 @@ on: jobs: build: - runs-on: ubuntu-latest + # We want to run on external PRs, but not on our own internal PRs as they'll be run + # by the push to the branch. Without this if check, checks are duplicated since + # internal PRs match both the push and pull_request events. + if: + github.event_name == 'push' || github.event.pull_request.head.repo.full_name != + github.repository + runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 diff --git a/.github/workflows/fuzz.yml b/.github/workflows/fuzz.yml index 0153767..f3b688f 100644 --- a/.github/workflows/fuzz.yml +++ b/.github/workflows/fuzz.yml @@ -4,6 +4,13 @@ on: [push, pull_request] jobs: build: + # We want to run on external PRs, but not on our own internal PRs as they'll be run + # by the push to the branch. Without this if check, checks are duplicated since + # internal PRs match both the push and pull_request events. + if: + github.event_name == 'push' || github.event.pull_request.head.repo.full_name != + github.repository + runs-on: ubuntu-latest strategy: fail-fast: false diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index fa7286e..e01e9ad 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -4,6 +4,13 @@ on: [push, pull_request] jobs: build: + # We want to run on external PRs, but not on our own internal PRs as they'll be run + # by the push to the branch. Without this if check, checks are duplicated since + # internal PRs match both the push and pull_request events. + if: + github.event_name == 'push' || github.event.pull_request.head.repo.full_name != + github.repository + runs-on: ubuntu-latest strategy: matrix: diff --git a/.github/workflows/primer.yml b/.github/workflows/primer.yml index b623b93..4c5751a 100644 --- a/.github/workflows/primer.yml +++ b/.github/workflows/primer.yml @@ -4,6 +4,13 @@ on: [push, pull_request] jobs: build: + # We want to run on external PRs, but not on our own internal PRs as they'll be run + # by the push to the branch. Without this if check, checks are duplicated since + # internal PRs match both the push and pull_request events. + if: + github.event_name == 'push' || github.event.pull_request.head.repo.full_name != + github.repository + runs-on: ${{ matrix.os }} strategy: fail-fast: false diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 8dd4e4f..bec7690 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -4,6 +4,13 @@ on: [push, pull_request] jobs: build: + # We want to run on external PRs, but not on our own internal PRs as they'll be run + # by the push to the branch. Without this if check, checks are duplicated since + # internal PRs match both the push and pull_request events. + if: + github.event_name == 'push' || github.event.pull_request.head.repo.full_name != + github.repository + runs-on: ${{ matrix.os }} strategy: fail-fast: false