Skip to content

Commit 43cf0f0

Browse files
fp024Copilot
andcommitted
Maven 빌드 워크플로우에 변경 감지 작업 추가
독립적인 다른 곳을 수정해도, 워크플로우가 무조건 실행되서... 1. my-board-spring5 2. my-board 두가지 프로젝트의 수정이 있을 때만, 워크플로우가 실행되도록 하였다. 워크플로우 설정파일이 수정되었을 때는.. 모든 Job이 실행된다. Co-authored-by: Copilot <copilot@github.com>
1 parent 757f5e2 commit 43cf0f0

1 file changed

Lines changed: 27 additions & 0 deletions

File tree

.github/workflows/maven-build.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,34 @@ name: Maven Build Test
66
on:
77
push:
88
branches: [ master ]
9+
paths:
10+
- 'part-last/my-board-spring5/**'
11+
- 'part-last/my-board/**'
12+
- '.github/workflows/maven-build.yml'
913

1014
jobs:
15+
detect-changes:
16+
runs-on: ubuntu-latest
17+
outputs:
18+
my-board-spring5: ${{ steps.filter.outputs.my-board-spring5 }}
19+
my-board: ${{ steps.filter.outputs.my-board }}
20+
workflow: ${{ steps.filter.outputs.workflow }}
21+
steps:
22+
- uses: actions/checkout@v4
23+
- uses: dorny/paths-filter@v3
24+
id: filter
25+
with:
26+
filters: |
27+
my-board-spring5:
28+
- 'part-last/my-board-spring5/**'
29+
my-board:
30+
- 'part-last/my-board/**'
31+
workflow:
32+
- '.github/workflows/maven-build.yml'
33+
1134
build-my-board-spring5-java17:
35+
needs: detect-changes
36+
if: needs.detect-changes.outputs.my-board-spring5 == 'true' || needs.detect-changes.outputs.workflow == 'true'
1237
runs-on: ubuntu-latest
1338
permissions:
1439
contents: read
@@ -27,6 +52,8 @@ jobs:
2752
run: mvn -B clean test --file part-last/my-board-spring5/pom.xml
2853

2954
build-my-board-java21:
55+
needs: detect-changes
56+
if: needs.detect-changes.outputs.my-board == 'true' || needs.detect-changes.outputs.workflow == 'true'
3057
runs-on: ubuntu-latest
3158
permissions:
3259
contents: read

0 commit comments

Comments
 (0)