Skip to content

Commit e956007

Browse files
committed
🤖 ci: gate CI jobs by changed paths
Add a changes-classifier job using dorny/paths-filter and gate lint/test/lint-actions by relevant file changes. Update publish-main to tolerate intentionally skipped dependencies while still requiring success when jobs do run. --- _Generated with [`mux`](https://github.com/coder/mux) • Model: `openai:gpt-5.3-codex` • Thinking: `xhigh` • Cost: `$0.16`_ <!-- mux-attribution: model=openai:gpt-5.3-codex thinking=xhigh costs=0.16 -->
1 parent f8b95f6 commit e956007

1 file changed

Lines changed: 49 additions & 2 deletions

File tree

‎.github/workflows/ci.yaml‎

Lines changed: 49 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,43 @@ permissions:
1010
contents: read
1111

1212
jobs:
13+
changes:
14+
name: Detect changed paths
15+
runs-on: ubuntu-latest
16+
outputs:
17+
go: ${{ steps.filter.outputs.go }}
18+
workflows: ${{ steps.filter.outputs.workflows }}
19+
publish: ${{ steps.filter.outputs.publish }}
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
23+
with:
24+
persist-credentials: false
25+
26+
- name: Detect changed paths
27+
id: filter
28+
uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
29+
with:
30+
filters: |
31+
go:
32+
- '**/*.go'
33+
- 'go.mod'
34+
- 'go.sum'
35+
- 'vendor/**'
36+
- 'Makefile'
37+
workflows:
38+
- '.github/workflows/**'
39+
publish:
40+
- '**/*.go'
41+
- 'go.mod'
42+
- 'go.sum'
43+
- 'vendor/**'
44+
- 'Dockerfile*'
45+
- 'Dockerfile.goreleaser'
46+
1347
lint:
48+
needs: changes
49+
if: needs.changes.outputs.go == 'true'
1450
runs-on: ubuntu-latest
1551
steps:
1652
- name: Checkout
@@ -46,6 +82,8 @@ jobs:
4682
go-package: ./...
4783

4884
test:
85+
needs: changes
86+
if: needs.changes.outputs.go == 'true'
4987
runs-on: ubuntu-latest
5088
steps:
5189
- name: Checkout
@@ -77,6 +115,8 @@ jobs:
77115

78116
lint-actions:
79117
name: Lint GitHub Actions
118+
needs: changes
119+
if: needs.changes.outputs.workflows == 'true'
80120
runs-on: ubuntu-latest
81121
permissions:
82122
contents: read
@@ -122,8 +162,15 @@ jobs:
122162

123163
publish-main:
124164
name: Publish GHCR :main
125-
needs: [test, lint, lint-actions]
126-
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
165+
needs: [changes, test, lint, lint-actions]
166+
if: |
167+
always() &&
168+
github.event_name == 'push' &&
169+
github.ref == 'refs/heads/main' &&
170+
needs.changes.outputs.publish == 'true' &&
171+
(needs.test.result == 'success' || needs.test.result == 'skipped') &&
172+
(needs.lint.result == 'success' || needs.lint.result == 'skipped') &&
173+
(needs.lint-actions.result == 'success' || needs.lint-actions.result == 'skipped')
127174
runs-on: ubuntu-latest
128175
permissions:
129176
contents: read

0 commit comments

Comments
 (0)