Unverified Commit 76268ab0 authored by Richard Si's avatar Richard Si Committed by GitHub
Browse files

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
parent b8c1020b
Loading
Loading
Loading
Loading
+7 −1
Changes for .github/workflows/doc.yml: 7 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -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

+7 −0
Changes for .github/workflows/fuzz.yml: 7 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -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
+7 −0
Changes for .github/workflows/lint.yml: 7 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -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:
+7 −0
Changes for .github/workflows/primer.yml: 7 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -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
+7 −0
Changes for .github/workflows/test.yml: 7 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -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