Skip to content

Commit c50c40f

Browse files
committed
Apply suggestions from code reviews
1 parent 5f8ed66 commit c50c40f

File tree

1 file changed

+27
-28
lines changed

1 file changed

+27
-28
lines changed

.github/workflows/pypi.yml

Lines changed: 27 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ on:
33
push:
44
branches:
55
- main
6-
- auto-release
76
pull_request:
87
branches: [main]
98
release:
@@ -16,14 +15,18 @@ concurrency:
1615
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
1716
cancel-in-progress: true
1817

18+
permissions: {}
19+
1920
jobs:
2021
check_changes:
2122
runs-on: ubuntu-latest
2223
outputs:
23-
should_run: ${{ steps.filter.outputs.any_changed }}
24+
should_run: ${{ steps.set_should_run.outputs.should_run }}
2425
steps:
2526
- uses: actions/checkout@v4
26-
- uses: dorny/paths-filter@v2
27+
with:
28+
persist-credentials: false
29+
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
2730
id: filter
2831
with:
2932
filters: |
@@ -34,17 +37,27 @@ jobs:
3437
- 'pytensor/_version.py'
3538
- 'pytensor/scan_perform.pyx'
3639
- 'pytensor/scan_perform_ext.py'
40+
- name: Set should_run output
41+
id: set_should_run
42+
run: |
43+
if [[ "${{ github.event_name == 'release' ||
44+
(
45+
github.ref == 'refs/heads/main' ||
46+
github.event_name == 'pull_request'
47+
) && steps.filter.outputs.any_changed == 'true'
48+
}}" == "true" ]]; then
49+
echo "should_run=true" >> $GITHUB_OUTPUT
50+
else
51+
echo "should_run=false" >> $GITHUB_OUTPUT
52+
fi
3753
3854
# The job to build precompiled pypi wheels.
3955
make_sdist:
4056
name: Make SDist
4157
needs: check_changes
42-
# Run if it's a release, auto-release branch, or if relevant files changed on main
58+
# Run if it's a release or if relevant files changed on main
4359
if: |
44-
github.event_name == 'release' ||
45-
github.ref == 'refs/heads/auto-release' ||
46-
(github.ref == 'refs/heads/main' && needs.check_changes.outputs.should_run == 'true') ||
47-
(github.event_name == 'pull_request' && needs.check_changes.outputs.should_run == 'true')
60+
needs.check_changes.outputs.should_run == 'true'
4861
runs-on: ubuntu-latest
4962
permissions:
5063
# write id-token and attestations are required to attest build provenance
@@ -75,12 +88,9 @@ jobs:
7588
run_checks:
7689
name: Build & inspect our package.
7790
needs: check_changes
78-
# Run if it's a release, auto-release branch, or if relevant files changed on main
91+
# Run if it's a release or if relevant files changed on main
7992
if: |
80-
github.event_name == 'release' ||
81-
github.ref == 'refs/heads/auto-release' ||
82-
(github.ref == 'refs/heads/main' && needs.check_changes.outputs.should_run == 'true') ||
83-
(github.event_name == 'pull_request' && needs.check_changes.outputs.should_run == 'true')
93+
needs.check_changes.outputs.should_run == 'true'
8494
# Note: the resulting builds are not actually published.
8595
# This is purely for additional testing and diagnostic purposes.
8696
runs-on: ubuntu-latest
@@ -95,12 +105,9 @@ jobs:
95105
build_wheels:
96106
name: Build wheels for ${{ matrix.platform }}
97107
needs: check_changes
98-
# Run if it's a release, auto-release branch, or if relevant files changed on main
108+
# Run if it's a release or if relevant files changed on main
99109
if: |
100-
github.event_name == 'release' ||
101-
github.ref == 'refs/heads/auto-release' ||
102-
(github.ref == 'refs/heads/main' && needs.check_changes.outputs.should_run == 'true') ||
103-
(github.event_name == 'pull_request' && needs.check_changes.outputs.should_run == 'true')
110+
needs.check_changes.outputs.should_run == 'true'
104111
runs-on: ${{ matrix.platform }}
105112
permissions:
106113
# write id-token and attestations are required to attest build provenance
@@ -136,12 +143,9 @@ jobs:
136143
build_universal_wheel:
137144
name: Build universal wheel for Pyodide
138145
needs: check_changes
139-
# Run if it's a release, auto-release branch, or if relevant files changed on main
146+
# Run if it's a release or if relevant files changed on main
140147
if: |
141-
github.event_name == 'release' ||
142-
github.ref == 'refs/heads/auto-release' ||
143-
(github.ref == 'refs/heads/main' && needs.check_changes.outputs.should_run == 'true') ||
144-
(github.event_name == 'pull_request' && needs.check_changes.outputs.should_run == 'true')
148+
needs.check_changes.outputs.should_run == 'true'
145149
runs-on: ubuntu-latest
146150
permissions:
147151
# write id-token and attestations are required to attest build provenance
@@ -180,11 +184,6 @@ jobs:
180184
check_dist:
181185
name: Check dist
182186
needs: [check_changes, make_sdist, build_wheels]
183-
if: |
184-
github.event_name == 'release' ||
185-
github.ref == 'refs/heads/auto-release' ||
186-
(github.ref == 'refs/heads/main' && needs.check_changes.outputs.should_run == 'true') ||
187-
(github.event_name == 'pull_request' && needs.check_changes.outputs.should_run == 'true')
188187
runs-on: ubuntu-22.04
189188
steps:
190189
- uses: actions/download-artifact@v4

0 commit comments

Comments
 (0)