Skip to content

Commit 822de04

Browse files
committed
πŸ‘· ci(build): always post build gate on pull requests
The build workflows filtered at the pull_request path level, so a PR that left the package source untouched never ran them and their required gate (build / βœ… <pkg>-build) never posted, leaving the PR blocked on a check that could not arrive. Trigger the build workflows on every pull request and move the path check into an internal changes job, passing the result to the reusable build as a run input. When it is false the bump job is skipped and the matrix jobs skip with it, while the always-run aggregate job still posts a green gate. Push and release paths keep their existing filters and run the full build.
1 parent 64914d1 commit 822de04

3 files changed

Lines changed: 58 additions & 12 deletions

File tree

β€Ž.github/workflows/_build.yamlβ€Ž

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@ on:
99
required: true
1010
type: string
1111
description: "Pre-commit mirror repo (e.g. tox-dev/pyproject-fmt)"
12+
run:
13+
required: false
14+
type: string
15+
default: "true"
16+
description: "When 'false', skip the build jobs but still post the aggregate gate"
1217
outputs:
1318
version:
1419
value: ${{ jobs.bump.outputs.version }}
@@ -25,6 +30,7 @@ env:
2530
jobs:
2631
bump:
2732
name: πŸ”– bump
33+
if: ${{ inputs.run == 'true' }}
2834
runs-on: ubuntu-24.04
2935
permissions:
3036
pull-requests: read

β€Ž.github/workflows/pyproject_fmt_build.yamlβ€Ž

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,6 @@ on:
1717
- ".github/workflows/pyproject_fmt_build.yaml"
1818
- ".github/workflows/_build.yaml"
1919
pull_request:
20-
paths:
21-
- "common/**"
22-
- "toml-fmt-common/**"
23-
- "pyproject-fmt/**"
24-
- ".github/workflows/pyproject_fmt_build.yaml"
25-
- ".github/workflows/_build.yaml"
2620
schedule:
2721
- cron: "0 8 * * *"
2822

@@ -31,11 +25,37 @@ concurrency:
3125
cancel-in-progress: ${{ github.event.inputs.release == 'no' || github.event.inputs.release == null }}
3226

3327
jobs:
28+
changes:
29+
name: πŸ” changes
30+
runs-on: ubuntu-latest
31+
permissions:
32+
contents: read
33+
outputs:
34+
run: ${{ github.event_name != 'pull_request' || steps.filter.outputs.run == 'true' }}
35+
steps:
36+
- name: πŸ“₯ Checkout
37+
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
38+
with:
39+
persist-credentials: false
40+
- name: πŸ” Check for changes
41+
uses: dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # v4.0.1
42+
id: filter
43+
with:
44+
filters: |
45+
run:
46+
- 'common/**'
47+
- 'toml-fmt-common/**'
48+
- 'pyproject-fmt/**'
49+
- '.github/workflows/pyproject_fmt_build.yaml'
50+
- '.github/workflows/_build.yaml'
51+
3452
build:
53+
needs: changes
3554
uses: ./.github/workflows/_build.yaml
3655
with:
3756
package-name: pyproject-fmt
3857
pre-commit-mirror: tox-dev/pyproject-fmt
58+
run: ${{ needs.changes.outputs.run }}
3959
secrets: inherit # zizmor: ignore[secrets-inherit]
4060
permissions:
4161
contents: write

β€Ž.github/workflows/tox_toml_fmt_build.yamlβ€Ž

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,6 @@ on:
1717
- ".github/workflows/tox_toml_fmt_build.yaml"
1818
- ".github/workflows/_build.yaml"
1919
pull_request:
20-
paths:
21-
- "common/**"
22-
- "toml-fmt-common/**"
23-
- "tox-toml-fmt/**"
24-
- ".github/workflows/tox_toml_fmt_build.yaml"
25-
- ".github/workflows/_build.yaml"
2620
schedule:
2721
- cron: "0 8 * * *"
2822

@@ -31,11 +25,37 @@ concurrency:
3125
cancel-in-progress: ${{ github.event.inputs.release == 'no' || github.event.inputs.release == null }}
3226

3327
jobs:
28+
changes:
29+
name: πŸ” changes
30+
runs-on: ubuntu-latest
31+
permissions:
32+
contents: read
33+
outputs:
34+
run: ${{ github.event_name != 'pull_request' || steps.filter.outputs.run == 'true' }}
35+
steps:
36+
- name: πŸ“₯ Checkout
37+
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
38+
with:
39+
persist-credentials: false
40+
- name: πŸ” Check for changes
41+
uses: dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # v4.0.1
42+
id: filter
43+
with:
44+
filters: |
45+
run:
46+
- 'common/**'
47+
- 'toml-fmt-common/**'
48+
- 'tox-toml-fmt/**'
49+
- '.github/workflows/tox_toml_fmt_build.yaml'
50+
- '.github/workflows/_build.yaml'
51+
3452
build:
53+
needs: changes
3554
uses: ./.github/workflows/_build.yaml
3655
with:
3756
package-name: tox-toml-fmt
3857
pre-commit-mirror: tox-dev/tox-toml-fmt
58+
run: ${{ needs.changes.outputs.run }}
3959
secrets: inherit # zizmor: ignore[secrets-inherit]
4060
permissions:
4161
contents: write

0 commit comments

Comments
Β (0)