Skip to content

Commit 7c6e096

Browse files
feat remove github action caches
1 parent 92782c1 commit 7c6e096

File tree

4 files changed

+60
-8
lines changed

4 files changed

+60
-8
lines changed

.github/workflows/backend-ci.yml

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Backend Development Pipeline
22

33
on:
44
push:
5-
branches: [ main ]
5+
branches: [ main, feat/remove-github-cache ]
66
paths:
77
- 'backend/**'
88
pull_request:
@@ -53,15 +53,40 @@ jobs:
5353
restore-keys: |
5454
${{ runner.os }}-sbt-
5555
56-
# 5. Build (compile & stage)
56+
# 5. Clean old caches (keep only 10 most recent)
57+
- name: Clean old caches
58+
# if: github.ref == 'refs/heads/main'
59+
uses: actions/github-script@v7
60+
with:
61+
script: |
62+
const caches = await github.rest.actions.getActionsCacheList({
63+
owner: context.repo.owner,
64+
repo: context.repo.repo,
65+
per_page: 100,
66+
sort: 'created_at',
67+
direction: 'desc'
68+
});
69+
70+
const cachesToDelete = caches.data.actions_caches.slice(20);
71+
72+
for (const cache of cachesToDelete) {
73+
console.log(`Deleting cache: ${cache.key} (ID: ${cache.id})`);
74+
await github.rest.actions.deleteActionsCacheById({
75+
owner: context.repo.owner,
76+
repo: context.repo.repo,
77+
cache_id: cache.id
78+
});
79+
}
80+
81+
# 6. Build (compile & stage)
5782
- name: Build Play Framework App
5883
run: sbt stage
5984

60-
# 6. Run Scalastyle (Static Code Analysis)
85+
# 7. Run Scalastyle (Static Code Analysis)
6186
- name: Run Scalastyle
6287
run: sbt scalastyle
6388

64-
# 7. Run tests with coverage
89+
# 8. Run tests with coverage
6590
- name: Run Scoverage Tests
6691
run: sbt clean coverage test coverageReport coverageAggregate
6792

.github/workflows/frontend-ci.yml

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Frontend Development Pipeline
22

33
on:
44
push:
5-
branches: [ main ]
5+
branches: [ main, feat/remove-github-cache ]
66
paths:
77
- 'frontend/**'
88
pull_request:
@@ -33,7 +33,32 @@ jobs:
3333
cache: 'npm'
3434
cache-dependency-path: frontend/package-lock.json
3535

36-
# 2. Install dependencies
36+
# 2. Clean old caches (keep only 10 most recent)
37+
- name: Clean old npm caches
38+
# if: github.ref == 'refs/heads/main'
39+
uses: actions/github-script@v7
40+
with:
41+
script: |
42+
const caches = await github.rest.actions.getActionsCacheList({
43+
owner: context.repo.owner,
44+
repo: context.repo.repo,
45+
per_page: 100,
46+
sort: 'created_at',
47+
direction: 'desc'
48+
});
49+
50+
const cachesToDelete = caches.data.actions_caches.slice(20);
51+
52+
for (const cache of cachesToDelete) {
53+
console.log(`Deleting cache: ${cache.key} (ID: ${cache.id})`);
54+
await github.rest.actions.deleteActionsCacheById({
55+
owner: context.repo.owner,
56+
repo: context.repo.repo,
57+
cache_id: cache.id
58+
});
59+
}
60+
61+
# 3. Install dependencies
3762
- name: Install dependencies
3863
run: npm ci
3964

@@ -44,13 +69,13 @@ jobs:
4469
npm run format:check || true
4570
npx tsc --noEmit || true
4671
47-
# 4. Run Tests
72+
# 5. Run Tests
4873
- name: Run Unit Tests & Coverage
4974
run: |
5075
npm run test:run
5176
npm run test:coverage
5277
53-
# 5. Build & Deploy
78+
# 6. Build & Deploy
5479
- name: Build & Deploy
5580
run: |
5681
npm run build

backend/hello.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
1

frontend/hello.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
1

0 commit comments

Comments
 (0)