Skip to content

Commit 54e28a2

Browse files
authored
fix: separate generate and cleanup actions (#78)
* fix: separate generate and cleanup actions * fix: review comments
1 parent b4fbb2b commit 54e28a2

4 files changed

Lines changed: 46 additions & 40 deletions

File tree

.github/workflows/cleanup.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Cleanup catalog
2+
3+
on:
4+
schedule:
5+
- cron: 0 7 1 * *
6+
7+
jobs:
8+
cleanup-catalog:
9+
runs-on: ubuntu-latest
10+
strategy:
11+
matrix:
12+
offset: [0, 10, 20, 30, 40, 50, 60, 70, 80, 90]
13+
max-parallel: 1
14+
steps:
15+
- uses: actions/checkout@v6
16+
17+
- uses: prefix-dev/setup-pixi@v0
18+
with:
19+
cache: true
20+
21+
- name: Pull latest changes
22+
run: |
23+
git pull --rebase origin ${{ github.ref }}
24+
25+
- name: cleanup-catalog
26+
env:
27+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
28+
OFFSET: ${{ matrix.offset }}
29+
run: pixi run cleanup-catalog
30+
31+
- name: Commit files
32+
run: |
33+
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
34+
git config --local user.name "github-actions[bot]"
35+
git commit -m "Add changes" -a || echo "No changes to commit"
36+
37+
- name: Push changes
38+
uses: ad-m/github-push-action@v1
39+
with:
40+
github_token: ${{ secrets.GITHUB_TOKEN }}
41+
branch: ${{ github.ref }}

.github/workflows/deploy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ on:
66
types:
77
- completed
88
push:
9-
branches: [main, dev]
9+
branches: [main]
1010

1111
defaults:
1212
run:

.github/workflows/generate.yml

Lines changed: 3 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@ on:
44
schedule:
55
- cron: 0 5 * * 1
66
push:
7-
branches: [main, dev]
7+
branches: [main]
88

99
jobs:
1010
generate-catalog:
11+
if: github.event_name == 'schedule' || github.actor != 'github-actions[bot]'
1112
runs-on: ubuntu-latest
1213
strategy:
1314
matrix:
@@ -38,43 +39,7 @@ jobs:
3839
git commit -m "Add changes" -a || echo "No changes to commit"
3940
4041
- name: Push changes
41-
uses: ad-m/github-push-action@master
42-
with:
43-
github_token: ${{ secrets.GITHUB_TOKEN }}
44-
branch: ${{ github.ref }}
45-
46-
cleanup-catalog:
47-
runs-on: ubuntu-latest
48-
needs: generate-catalog
49-
strategy:
50-
matrix:
51-
offset: [0, 10, 20, 30, 40, 50, 60, 70, 80, 90]
52-
max-parallel: 1
53-
steps:
54-
- uses: actions/checkout@v6
55-
56-
- uses: prefix-dev/setup-pixi@v0
57-
with:
58-
cache: true
59-
60-
- name: Pull latest changes
61-
run: |
62-
git pull --rebase origin ${{ github.ref }}
63-
64-
- name: cleanup-catalog
65-
env:
66-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
67-
OFFSET: ${{ matrix.offset }}
68-
run: pixi run cleanup-catalog
69-
70-
- name: Commit files
71-
run: |
72-
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
73-
git config --local user.name "github-actions[bot]"
74-
git commit -m "Add changes" -a || echo "No changes to commit"
75-
76-
- name: Push changes
77-
uses: ad-m/github-push-action@master
42+
uses: ad-m/github-push-action@v1
7843
with:
7944
github_token: ${{ secrets.GITHUB_TOKEN }}
8045
branch: ${{ github.ref }}

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Test
22

33
on:
44
pull_request:
5-
branches: [main, dev]
5+
branches: [main]
66

77
jobs:
88
generate-catalog:

0 commit comments

Comments
 (0)