Skip to content

Commit 29e68b1

Browse files
committed
chore(ci/cd): 특정 경로의 변경이 있을 때만 실행
1 parent 7958f40 commit 29e68b1

1 file changed

Lines changed: 64 additions & 4 deletions

File tree

.github/workflows/ci.yml

Lines changed: 64 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,30 @@ on:
66
- production
77
- develop
88
- 'feature/**'
9+
paths:
10+
- 'apps/web/**'
11+
- 'apps/api/**'
12+
- 'apps/api-springboot/**'
13+
- 'infra/**'
14+
- 'ansible/**'
15+
- 'terraform/**'
16+
- 'monitoring/**'
17+
- 'docker-compose.yml'
18+
- '.github/workflows/**'
919
pull_request:
1020
branches:
1121
- production
1222
- develop
23+
paths:
24+
- 'apps/web/**'
25+
- 'apps/api/**'
26+
- 'apps/api-springboot/**'
27+
- 'infra/**'
28+
- 'ansible/**'
29+
- 'terraform/**'
30+
- 'monitoring/**'
31+
- 'docker-compose.yml'
32+
- '.github/workflows/**'
1333

1434
permissions:
1535
contents: read
@@ -21,12 +41,49 @@ env:
2141
JAVA_VERSION: '21'
2242

2343
jobs:
44+
# ============================================
45+
# Detect Changes
46+
# ============================================
47+
changes:
48+
runs-on: ubuntu-latest
49+
timeout-minutes: 10
50+
permissions:
51+
contents: read
52+
outputs:
53+
web: ${{ steps.filter.outputs.web }}
54+
api: ${{ steps.filter.outputs.api }}
55+
springboot: ${{ steps.filter.outputs.springboot }}
56+
infra: ${{ steps.filter.outputs.infra }}
57+
steps:
58+
- uses: actions/checkout@v4
59+
- uses: dorny/paths-filter@v3
60+
id: filter
61+
with:
62+
filters: |
63+
web:
64+
- 'apps/web/**'
65+
- '.github/workflows/**'
66+
api:
67+
- 'apps/api/**'
68+
- '.github/workflows/**'
69+
springboot:
70+
- 'apps/api-springboot/**'
71+
- '.github/workflows/**'
72+
infra:
73+
- 'infra/**'
74+
- 'ansible/**'
75+
- 'terraform/**'
76+
- 'monitoring/**'
77+
- 'docker-compose.yml'
78+
- '.github/workflows/**'
79+
2480
# ============================================
2581
# Web (Next.js) CI
2682
# ============================================
2783
web-ci:
2884
name: Web - Build & Test
29-
if: "!startsWith(github.event.head_commit.message, 'docs') && !startsWith(github.event.head_commit.message, 'chore') && !startsWith(github.event.head_commit.message, 'test')"
85+
needs: changes
86+
if: ${{ needs.changes.outputs.web == 'true' }}
3087
runs-on: ubuntu-latest
3188
defaults:
3289
run:
@@ -70,7 +127,8 @@ jobs:
70127
# ============================================
71128
api-nestjs-ci:
72129
name: API NestJS - Build & Test
73-
if: "!startsWith(github.event.head_commit.message, 'docs') && !startsWith(github.event.head_commit.message, 'chore') && !startsWith(github.event.head_commit.message, 'test')"
130+
needs: changes
131+
if: ${{ needs.changes.outputs.api == 'true' }}
74132
runs-on: ubuntu-latest
75133
defaults:
76134
run:
@@ -159,7 +217,8 @@ jobs:
159217
# ============================================
160218
api-springboot-ci:
161219
name: API Spring Boot - Build & Test
162-
if: "!startsWith(github.event.head_commit.message, 'docs') && !startsWith(github.event.head_commit.message, 'chore') && !startsWith(github.event.head_commit.message, 'test')"
220+
needs: changes
221+
if: ${{ needs.changes.outputs.springboot == 'true' }}
163222
runs-on: ubuntu-latest
164223
defaults:
165224
run:
@@ -229,7 +288,8 @@ jobs:
229288
# ============================================
230289
infra-ci:
231290
name: Infrastructure - Validate
232-
if: "!startsWith(github.event.head_commit.message, 'docs') && !startsWith(github.event.head_commit.message, 'chore') && !startsWith(github.event.head_commit.message, 'test')"
291+
needs: changes
292+
if: ${{ needs.changes.outputs.infra == 'true' }}
233293
runs-on: ubuntu-latest
234294

235295
steps:

0 commit comments

Comments
 (0)