Skip to content

Commit e4f6207

Browse files
committed
ci: otimization detect changes
1 parent 0d9c09b commit e4f6207

File tree

3 files changed

+55
-0
lines changed

3 files changed

+55
-0
lines changed

.github/workflows/build.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,16 @@ name: Timeless CI - Build & Publish
33
on:
44
push:
55
branches: [ "main" ]
6+
paths:
7+
- 'timeless-api/**'
8+
- 'whatsapp/**'
69
paths-ignore:
710
- 'infrastructure/**'
811
pull_request:
912
branches: [ "main" ]
13+
paths:
14+
- 'timeless-api/**'
15+
- 'whatsapp/**'
1016
paths-ignore:
1117
- 'infrastructure/**'
1218

@@ -21,8 +27,13 @@ env:
2127
PUBLISH: ${{ github.repository == 'mcruzdev/timeless' && github.event_name == 'push' && github.ref == 'refs/heads/main' }}
2228

2329
jobs:
30+
detect-changes:
31+
uses: ./.github/workflows/detect_changes.yml
32+
2433
timeless-api:
2534
name: Build & Publish - Timeless API (Java)
35+
needs: detect-changes
36+
if: needs.detect-changes.outputs.api == 'true'
2637
runs-on: ubuntu-latest
2738
defaults:
2839
run:
@@ -84,6 +95,8 @@ jobs:
8495

8596
whatsapp:
8697
name: Build & Publish - WhatsApp Bot (Node.js)
98+
needs: detect-changes
99+
if: needs.detect-changes.outputs.whatsapp == 'true'
87100
runs-on: ubuntu-latest
88101
defaults:
89102
run:
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Detect Changed Paths
2+
3+
on:
4+
workflow_call:
5+
outputs:
6+
api:
7+
description: Whether API paths changed
8+
value: ${{ jobs.changes.outputs.api }}
9+
whatsapp:
10+
description: Whether WhatsApp paths changed
11+
value: ${{ jobs.changes.outputs.whatsapp }}
12+
13+
jobs:
14+
changes:
15+
name: Detect changed paths
16+
runs-on: ubuntu-latest
17+
outputs:
18+
api: ${{ steps.filter.outputs.api }}
19+
whatsapp: ${{ steps.filter.outputs.whatsapp }}
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@v5
23+
24+
- name: Filter paths
25+
id: filter
26+
uses: dorny/paths-filter@v3
27+
with:
28+
filters: |
29+
api:
30+
- 'timeless-api/**'
31+
whatsapp:
32+
- 'whatsapp/**'

.github/workflows/pull_request.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ name: Timeless CI - Pull Request Build
33
on:
44
pull_request:
55
branches: [ "main" ]
6+
paths:
7+
- 'timeless-api/**'
8+
- 'whatsapp/**'
69
paths-ignore:
710
- 'infrastructure/**'
811

@@ -14,8 +17,13 @@ concurrency:
1417
cancel-in-progress: true
1518

1619
jobs:
20+
detect-changes:
21+
uses: ./.github/workflows/detect_changes.yml
22+
1723
timeless-api:
1824
name: Build Timeless API (Backend)
25+
needs: detect-changes
26+
if: needs.detect-changes.outputs.api == 'true'
1927
runs-on: ubuntu-latest
2028
defaults:
2129
run:
@@ -56,6 +64,8 @@ jobs:
5664

5765
whatsapp:
5866
name: Build WhatsApp Bot (Node.js)
67+
needs: detect-changes
68+
if: needs.detect-changes.outputs.whatsapp == 'true'
5969
runs-on: ubuntu-latest
6070
defaults:
6171
run:

0 commit comments

Comments
 (0)