Skip to content

Commit 4e6458a

Browse files
xerialclaude
andauthored
Skip CI tests for non-code changes using dorny/paths-filter (#901)
- Add dorny/paths-filter action to detect file changes - Skip code format and test jobs when only docs are changed - Improve CI efficiency by running tests only when needed 🤖 Generated with [Claude Code](https://claude.ai/code) Co-authored-by: Claude <[email protected]>
1 parent fe697bc commit 4e6458a

File tree

1 file changed

+30
-13
lines changed

1 file changed

+30
-13
lines changed

.github/workflows/CI.yml

Lines changed: 30 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,42 @@ name: CI
22

33
on:
44
pull_request:
5-
paths:
6-
- '**.scala'
7-
- '**.java'
8-
- '**.sbt'
9-
- '.github/workflows/**.yml'
10-
- 'project/build.properties'
115
push:
126
branches:
137
- main
14-
paths:
15-
- '**.scala'
16-
- '**.java'
17-
- '**.sbt'
18-
- '.github/workflows/**.yml'
19-
- 'project/build.properties'
20-
workflow_dispatch:
8+
workflow_dispatch:
219

2210
jobs:
11+
changes:
12+
runs-on: ubuntu-latest
13+
outputs:
14+
code: ${{ steps.changes.outputs.code }}
15+
docs: ${{ steps.changes.outputs.docs }}
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v4
19+
- uses: dorny/paths-filter@v3
20+
id: changes
21+
with:
22+
filters: |
23+
code:
24+
- '**.scala'
25+
- '**.java'
26+
- '**.sbt'
27+
- '.github/workflows/**.yml'
28+
- 'project/build.properties'
29+
- 'msgpack-core/**'
30+
- 'msgpack-jackson/**'
31+
docs:
32+
- '**.md'
33+
- '**.txt'
34+
- 'LICENSE'
35+
2336
code_format:
2437
name: Code Format
2538
runs-on: ubuntu-latest
39+
needs: changes
40+
if: ${{ needs.changes.outputs.code == 'true' }}
2641
steps:
2742
- uses: actions/checkout@v4
2843
- name: jcheckstyle
@@ -31,6 +46,8 @@ jobs:
3146
test:
3247
name: Test JDK${{ matrix.java }}
3348
runs-on: ubuntu-latest
49+
needs: changes
50+
if: ${{ needs.changes.outputs.code == 'true' }}
3451
strategy:
3552
matrix:
3653
java: ['8', '11', '17', '21', '24']

0 commit comments

Comments
 (0)