Skip to content

Commit

Permalink
Fix third party scheduled tests running on forks (#525)
Browse files Browse the repository at this point in the history
* Fix third party scheduled tests running on forks

* Refactor repeated condition to predicate job
  • Loading branch information
brianschubert authored Dec 22, 2024
1 parent 1ee20f7 commit 15d48b2
Showing 1 changed file with 18 additions and 70 deletions.
88 changes: 18 additions & 70 deletions .github/workflows/third_party.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,20 @@ concurrency:
cancel-in-progress: true

jobs:
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
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'
)
}}
needs: skip-schedule-on-fork
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -72,16 +74,7 @@ jobs:

typing_inspect:
name: typing_inspect tests
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'
)
}}
needs: skip-schedule-on-fork
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -117,16 +110,7 @@ jobs:
pyanalyze:
name: pyanalyze tests
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'
)
}}
needs: skip-schedule-on-fork
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -163,16 +147,7 @@ jobs:
typeguard:
name: typeguard tests
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'
)
}}
needs: skip-schedule-on-fork
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -210,16 +185,7 @@ jobs:
typed-argument-parser:
name: typed-argument-parser tests
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'
)
}}
needs: skip-schedule-on-fork
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -262,16 +228,7 @@ jobs:
mypy:
name: stubtest & mypyc tests
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'
)
}}
needs: skip-schedule-on-fork
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -309,16 +266,7 @@ jobs:
cattrs:
name: cattrs tests
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'
)
}}
needs: skip-schedule-on-fork
strategy:
fail-fast: false
matrix:
Expand Down

0 comments on commit 15d48b2

Please sign in to comment.