From 9a011cb4e1ad509df1377b2159a63c2c486461d9 Mon Sep 17 00:00:00 2001 From: Brian Schubert Date: Sun, 22 Dec 2024 14:48:58 -0500 Subject: [PATCH 1/2] Fix third party scheduled tests running on forks --- .github/workflows/third_party.yml | 91 ++++++++++--------------------- 1 file changed, 28 insertions(+), 63 deletions(-) diff --git a/.github/workflows/third_party.yml b/.github/workflows/third_party.yml index d5a85399..b06b4a50 100644 --- a/.github/workflows/third_party.yml +++ b/.github/workflows/third_party.yml @@ -28,16 +28,11 @@ concurrency: jobs: pydantic: name: pydantic tests + # if 'schedule' was the trigger, + # don't run it on contributors' forks if: >- - # if 'schedule' was the trigger, - # don't run it on contributors' forks - ${{ - github.event_name != 'schedule' - || ( - github.repository == 'python/typing_extensions' - && github.event_name == 'schedule' - ) - }} + github.repository == 'python/typing_extensions' + || github.event_name != 'schedule' strategy: fail-fast: false matrix: @@ -72,16 +67,11 @@ jobs: typing_inspect: name: typing_inspect tests + # if 'schedule' was the trigger, + # don't run it on contributors' forks if: >- - # if 'schedule' was the trigger, - # don't run it on contributors' forks - ${{ - github.event_name != 'schedule' - || ( - github.repository == 'python/typing_extensions' - && github.event_name == 'schedule' - ) - }} + github.repository == 'python/typing_extensions' + || github.event_name != 'schedule' strategy: fail-fast: false matrix: @@ -117,16 +107,11 @@ jobs: pyanalyze: name: pyanalyze tests + # if 'schedule' was the trigger, + # don't run it on contributors' forks if: >- - # if 'schedule' was the trigger, - # don't run it on contributors' forks - ${{ - github.event_name != 'schedule' - || ( - github.repository == 'python/typing_extensions' - && github.event_name == 'schedule' - ) - }} + github.repository == 'python/typing_extensions' + || github.event_name != 'schedule' strategy: fail-fast: false matrix: @@ -163,16 +148,11 @@ jobs: typeguard: name: typeguard tests + # if 'schedule' was the trigger, + # don't run it on contributors' forks if: >- - # if 'schedule' was the trigger, - # don't run it on contributors' forks - ${{ - github.event_name != 'schedule' - || ( - github.repository == 'python/typing_extensions' - && github.event_name == 'schedule' - ) - }} + github.repository == 'python/typing_extensions' + || github.event_name != 'schedule' strategy: fail-fast: false matrix: @@ -210,16 +190,11 @@ jobs: typed-argument-parser: name: typed-argument-parser tests + # if 'schedule' was the trigger, + # don't run it on contributors' forks if: >- - # if 'schedule' was the trigger, - # don't run it on contributors' forks - ${{ - github.event_name != 'schedule' - || ( - github.repository == 'python/typing_extensions' - && github.event_name == 'schedule' - ) - }} + github.repository == 'python/typing_extensions' + || github.event_name != 'schedule' strategy: fail-fast: false matrix: @@ -262,16 +237,11 @@ jobs: mypy: name: stubtest & mypyc tests + # if 'schedule' was the trigger, + # don't run it on contributors' forks if: >- - # if 'schedule' was the trigger, - # don't run it on contributors' forks - ${{ - github.event_name != 'schedule' - || ( - github.repository == 'python/typing_extensions' - && github.event_name == 'schedule' - ) - }} + github.repository == 'python/typing_extensions' + || github.event_name != 'schedule' strategy: fail-fast: false matrix: @@ -309,16 +279,11 @@ jobs: cattrs: name: cattrs tests + # if 'schedule' was the trigger, + # don't run it on contributors' forks if: >- - # if 'schedule' was the trigger, - # don't run it on contributors' forks - ${{ - github.event_name != 'schedule' - || ( - github.repository == 'python/typing_extensions' - && github.event_name == 'schedule' - ) - }} + github.repository == 'python/typing_extensions' + || github.event_name != 'schedule' strategy: fail-fast: false matrix: From b0c5e656dba3220b0c142cca174414b6c98ecf18 Mon Sep 17 00:00:00 2001 From: Brian Schubert Date: Sun, 22 Dec 2024 14:48:58 -0500 Subject: [PATCH 2/2] Refactor repeated condition to predicate job --- .github/workflows/third_party.yml | 47 ++++++++++--------------------- 1 file changed, 15 insertions(+), 32 deletions(-) diff --git a/.github/workflows/third_party.yml b/.github/workflows/third_party.yml index b06b4a50..d0cbb0bc 100644 --- a/.github/workflows/third_party.yml +++ b/.github/workflows/third_party.yml @@ -26,13 +26,20 @@ concurrency: cancel-in-progress: true jobs: - pydantic: - name: pydantic tests + skip-schedule-on-fork: + name: Check for schedule trigger on fork + runs-on: ubuntu-latest # if 'schedule' was the trigger, # don't run it on contributors' forks if: >- github.repository == 'python/typing_extensions' || github.event_name != 'schedule' + steps: + - run: true + + pydantic: + name: pydantic tests + needs: skip-schedule-on-fork strategy: fail-fast: false matrix: @@ -67,11 +74,7 @@ jobs: typing_inspect: name: typing_inspect tests - # if 'schedule' was the trigger, - # don't run it on contributors' forks - if: >- - github.repository == 'python/typing_extensions' - || github.event_name != 'schedule' + needs: skip-schedule-on-fork strategy: fail-fast: false matrix: @@ -107,11 +110,7 @@ jobs: pyanalyze: name: pyanalyze tests - # if 'schedule' was the trigger, - # don't run it on contributors' forks - if: >- - github.repository == 'python/typing_extensions' - || github.event_name != 'schedule' + needs: skip-schedule-on-fork strategy: fail-fast: false matrix: @@ -148,11 +147,7 @@ jobs: typeguard: name: typeguard tests - # if 'schedule' was the trigger, - # don't run it on contributors' forks - if: >- - github.repository == 'python/typing_extensions' - || github.event_name != 'schedule' + needs: skip-schedule-on-fork strategy: fail-fast: false matrix: @@ -190,11 +185,7 @@ jobs: typed-argument-parser: name: typed-argument-parser tests - # if 'schedule' was the trigger, - # don't run it on contributors' forks - if: >- - github.repository == 'python/typing_extensions' - || github.event_name != 'schedule' + needs: skip-schedule-on-fork strategy: fail-fast: false matrix: @@ -237,11 +228,7 @@ jobs: mypy: name: stubtest & mypyc tests - # if 'schedule' was the trigger, - # don't run it on contributors' forks - if: >- - github.repository == 'python/typing_extensions' - || github.event_name != 'schedule' + needs: skip-schedule-on-fork strategy: fail-fast: false matrix: @@ -279,11 +266,7 @@ jobs: cattrs: name: cattrs tests - # if 'schedule' was the trigger, - # don't run it on contributors' forks - if: >- - github.repository == 'python/typing_extensions' - || github.event_name != 'schedule' + needs: skip-schedule-on-fork strategy: fail-fast: false matrix: