Skip to content

Commit aba488a

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 aba488a

1 file changed

Lines changed: 54 additions & 2 deletions

File tree

‎.github/workflows/ci.yaml‎

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

1212
jobs:
13+
changes:
14+
name: Detect changed paths
15+
runs-on: ubuntu-latest
16+
permissions:
17+
contents: read
18+
pull-requests: read
19+
outputs:
20+
go: ${{ steps.filter.outputs.go }}
21+
workflows: ${{ steps.filter.outputs.workflows }}
22+
publish: ${{ steps.filter.outputs.publish }}
23+
steps:
24+
- name: Checkout
25+
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
26+
with:
27+
persist-credentials: false
28+
29+
- name: Detect changed paths
30+
id: filter
31+
uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
32+
with:
33+
filters: |
34+
go:
35+
- '**/*.go'
36+
- 'go.mod'
37+
- 'go.sum'
38+
- 'vendor/**'
39+
- 'Makefile'
40+
- '.golangci.yml'
41+
- '.golangci.yaml'
42+
workflows:
43+
- '.github/workflows/**'
44+
publish:
45+
- '**/*.go'
46+
- 'go.mod'
47+
- 'go.sum'
48+
- 'vendor/**'
49+
- 'Dockerfile*'
50+
- 'Dockerfile.goreleaser'
51+
1352
lint:
53+
needs: changes
54+
if: needs.changes.outputs.go == 'true'
1455
runs-on: ubuntu-latest
1556
steps:
1657
- name: Checkout
@@ -46,6 +87,8 @@ jobs:
4687
go-package: ./...
4788

4889
test:
90+
needs: changes
91+
if: needs.changes.outputs.go == 'true'
4992
runs-on: ubuntu-latest
5093
steps:
5194
- name: Checkout
@@ -77,6 +120,8 @@ jobs:
77120

78121
lint-actions:
79122
name: Lint GitHub Actions
123+
needs: changes
124+
if: needs.changes.outputs.workflows == 'true'
80125
runs-on: ubuntu-latest
81126
permissions:
82127
contents: read
@@ -122,8 +167,15 @@ jobs:
122167

123168
publish-main:
124169
name: Publish GHCR :main
125-
needs: [test, lint, lint-actions]
126-
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
170+
needs: [changes, test, lint, lint-actions]
171+
if: |
172+
always() &&
173+
github.event_name == 'push' &&
174+
github.ref == 'refs/heads/main' &&
175+
needs.changes.outputs.publish == 'true' &&
176+
(needs.test.result == 'success' || needs.test.result == 'skipped') &&
177+
(needs.lint.result == 'success' || needs.lint.result == 'skipped') &&
178+
(needs.lint-actions.result == 'success' || needs.lint-actions.result == 'skipped')
127179
runs-on: ubuntu-latest
128180
permissions:
129181
contents: read

0 commit comments

Comments
 (0)