Skip to content

Commit 99cb3c7

Browse files
committed
build: more readable syntax for check conditions
As suggested by Adam Johnson in a comment here: https://nedbatchelder.com/blog/202505/filtering_github_actions_by_changed_files.html
1 parent 2d63e17 commit 99cb3c7

File tree

3 files changed

+18
-6
lines changed

3 files changed

+18
-6
lines changed

.github/workflows/coverage.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@ jobs:
6767

6868
# Only run coverage if Python files or this workflow changed.
6969
needs: changed
70-
if: ${{ needs.changed.outputs.run_coverage == 'true' }}
70+
if:
71+
needs.changed.outputs.run_coverage == 'true'
7172

7273
env:
7374
MATRIX_ID: "${{ matrix.python-version }}.${{ matrix.os }}"

.github/workflows/quality.yml

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,10 @@ jobs:
6767
runs-on: macos-latest
6868

6969
needs: changed
70-
if: ${{ needs.changed.outputs.python == 'true' || needs.changed.outputs.actions == 'true' || needs.changed.outputs.workflow == 'true' }}
70+
if:
71+
needs.changed.outputs.python == 'true'
72+
|| needs.changed.outputs.actions == 'true'
73+
|| needs.changed.outputs.workflow == 'true'
7174

7275
steps:
7376
- name: "Check out the repo"
@@ -95,7 +98,9 @@ jobs:
9598
runs-on: ubuntu-latest
9699

97100
needs: changed
98-
if: ${{ needs.changed.outputs.python == 'true' || needs.changed.outputs.workflow == 'true' }}
101+
if:
102+
needs.changed.outputs.python == 'true'
103+
|| needs.changed.outputs.workflow == 'true'
99104

100105
steps:
101106
- name: "Check out the repo"
@@ -123,7 +128,9 @@ jobs:
123128
runs-on: ubuntu-latest
124129

125130
needs: changed
126-
if: ${{ needs.changed.outputs.docs == 'true' || needs.changed.outputs.workflow == 'true' }}
131+
if:
132+
needs.changed.outputs.docs == 'true'
133+
|| needs.changed.outputs.workflow == 'true'
127134

128135
steps:
129136
- name: "Check out the repo"
@@ -166,7 +173,9 @@ jobs:
166173
contents: read
167174

168175
needs: changed
169-
if: ${{ needs.changed.outputs.actions == 'true' || needs.changed.outputs.workflow == 'true' }}
176+
if:
177+
needs.changed.outputs.actions == 'true'
178+
|| needs.changed.outputs.workflow == 'true'
170179

171180
steps:
172181
- name: Checkout repository

.github/workflows/testsuite.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,9 @@ jobs:
6565
# Don't run tests if the branch name includes "-notests".
6666
# Only run tests if files that affect tests have changed.
6767
needs: changed
68-
if: ${{ needs.changed.outputs.run_tests == 'true' && !contains(github.ref, '-notests') }}
68+
if:
69+
needs.changed.outputs.run_tests == 'true'
70+
&& !contains(github.ref, '-notests')
6971

7072
env:
7173
TOX_GH_MAJOR_MINOR: "${{ matrix.python-version }}"

0 commit comments

Comments
 (0)