Skip to content

Commit a3e5f5b

Browse files
committed
feat(ci): add path-based filtering for template checks
- Add dorny/paths-filter to detect changed templates - Split verification into separate jobs per template - Only run builds/tests for modified templates - Add permissions for pull_requests read access
1 parent 5727575 commit a3e5f5b

1 file changed

Lines changed: 48 additions & 5 deletions

File tree

.github/workflows/template-check.yaml

Lines changed: 48 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,50 @@ on:
77
branches: [main]
88

99
jobs:
10-
verify-template:
10+
detect-changes:
11+
runs-on: ubuntu-latest
12+
permissions:
13+
pull-requests: read
14+
outputs:
15+
kotlin-spring: ${{ steps.filter.outputs.kotlin-spring }}
16+
go-gin: ${{ steps.filter.outputs.go-gin }}
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v4
20+
21+
- name: Check changed files
22+
uses: dorny/paths-filter@v3
23+
id: filter
24+
with:
25+
filters: |
26+
kotlin-spring: 'kotlin/spring/**'
27+
go-gin: 'go/gin/**'
28+
29+
verify-kotlin-spring:
30+
needs: detect-changes
31+
if: needs.detect-changes.outputs.kotlin-spring == 'true'
32+
runs-on: ubuntu-latest
33+
34+
steps:
35+
- name: Checkout
36+
uses: actions/checkout@v4
37+
38+
- name: Setup Bazel
39+
uses: bazel-contrib/setup-bazel@0.16.0
40+
with:
41+
bazelisk-cache: true
42+
disk-cache: ${{ github.workflow }}
43+
repository-cache: true
44+
45+
- name: Verify Kotlin Spring Template Builds
46+
run: bazel build //kotlin/spring/...
47+
48+
- name: Verify Kotlin Spring Template Tests
49+
run: bazel test //kotlin/spring/...
50+
51+
verify-go-gin:
52+
needs: detect-changes
53+
if: needs.detect-changes.outputs.go-gin == 'true'
1154
runs-on: ubuntu-latest
1255

1356
steps:
@@ -21,8 +64,8 @@ jobs:
2164
disk-cache: ${{ github.workflow }}
2265
repository-cache: true
2366

24-
- name: Verify Template Builds
25-
run: bazel build //...
67+
- name: Verify Go Gin Template Builds
68+
run: bazel build //go/gin/...
2669

27-
- name: Verify Template Tests
28-
run: bazel test //...
70+
- name: Verify Go Gin Template Tests
71+
run: bazel test //go/gin/...

0 commit comments

Comments
 (0)