Skip to content

Commit 65e48c9

Browse files
committed
Improve path-filtering rules on unit test action
1 parent 8327aa0 commit 65e48c9

File tree

1 file changed

+27
-22
lines changed

1 file changed

+27
-22
lines changed

.github/workflows/tests.yml

Lines changed: 27 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,44 @@
11
---
22
name: Unit tests
33
on:
4-
push:
5-
paths-ignore:
6-
- '**/*.md'
7-
- '**/*.asciidoc'
8-
- '**/*.txt'
9-
- 'docs/**'
10-
- '.ci/**'
11-
- '.buildkite/**'
12-
- 'scripts/**'
13-
- 'catalog-info.yaml'
14-
pull_request:
15-
paths-ignore:
16-
- '**/*.md'
17-
- '**/*.asciidoc'
18-
- '**/*.txt'
19-
- 'docs/**'
20-
- '.ci/**'
21-
- '.buildkite/**'
22-
- 'scripts/**'
23-
- 'catalog-info.yaml'
4+
pull_request: {}
245

256
jobs:
7+
paths-filter:
8+
name: Detect files changed
9+
runs-on: ubuntu-latest
10+
outputs:
11+
skip: '${{ steps.changes.outputs.skip }}'
12+
steps:
13+
- uses: actions/checkout@v4
14+
- uses: dorny/paths-filter/@v2.11.1
15+
id: changes
16+
with:
17+
filters: |
18+
skip:
19+
- '**/*.md'
20+
- '**/*.asciidoc'
21+
- '**/*.txt'
22+
- 'docs/**'
23+
- '.ci/**'
24+
- '.buildkite/**'
25+
- 'scripts/**'
26+
- 'catalog-info.yaml'
27+
2628
test:
2729
name: Test
2830
runs-on: ${{ matrix.os }}
31+
needs: paths-filter
32+
# only run if files not in `skip` filter were changed
33+
if: needs.paths-filter.outputs.skip != 'true'
2934

3035
strategy:
3136
matrix:
3237
node-version: [16.x, 18.x, 20.x]
3338
os: [ubuntu-latest, windows-latest, macOS-latest]
3439

3540
steps:
36-
- uses: actions/checkout@v3
41+
- uses: actions/checkout@v4
3742

3843
- name: Use Node.js ${{ matrix.node-version }}
3944
uses: actions/setup-node@v3
@@ -61,7 +66,7 @@ jobs:
6166
node-version: [20.x]
6267

6368
steps:
64-
- uses: actions/checkout@v3
69+
- uses: actions/checkout@v4
6570

6671
- name: Use Node.js ${{ matrix.node-version }}
6772
uses: actions/setup-node@v3

0 commit comments

Comments
 (0)