Skip to content

Commit 995fd9e

Browse files
authored
ci: use a unified reusable workflow (#18)
1 parent 6346890 commit 995fd9e

1 file changed

Lines changed: 13 additions & 38 deletions

File tree

Lines changed: 13 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,22 @@
1-
name: Update Worktree and Trigger Workflow
1+
name: Call Worktree Update
22

33
on:
44
push:
55
branches: [ "main" ]
6-
7-
schedule:
8-
- cron: '0 0 * * *'
9-
106
workflow_dispatch:
7+
schedule:
8+
- cron: '0 1 * * *'
119

1210
jobs:
13-
trigger:
14-
runs-on: ubuntu-latest
15-
permissions: write-all
11+
call_reusable_workflow:
12+
uses: HITSZ-OpenAuto/repos-management/.github/workflows/reusable_worktree_generate.yml@main
13+
permissions:
14+
contents: write
15+
pull-requests: write
1616

17-
steps:
18-
- name: Checkout repository
19-
uses: actions/checkout@v4
20-
with:
21-
fetch-depth: 0
22-
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
23-
24-
- name: Set up Python
25-
uses: actions/setup-python@v5
26-
with:
27-
python-version: '3.12'
28-
29-
- name: Download and run generate_worktree_info.py
30-
run: |
31-
# Download the script
32-
curl -o /tmp/generate_worktree_info.py https://raw.githubusercontent.com/HITSZ-OpenAuto/repos-management/main/scripts/generate_worktree_info.py
33-
34-
# Make it executable and run it
35-
chmod +x /tmp/generate_worktree_info.py
36-
python3 /tmp/generate_worktree_info.py
17+
with:
18+
# trigger_page_build == true only when pushing to main branch
19+
trigger_page_build: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
3720

38-
- name: Trigger workflow in hoa-moe
39-
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
40-
env:
41-
GITHUB_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
42-
run: |
43-
curl -X POST \
44-
-H "Accept: application/vnd.github.v3+json" \
45-
-H "Authorization: token $GITHUB_TOKEN" \
46-
https://api.github.com/repos/HITSZ-OpenAuto/hoa-moe/actions/workflows/course.yaml/dispatches \
47-
-d '{"ref":"main"}'
21+
secrets:
22+
PAT: ${{ secrets.PERSONAL_ACCESS_TOKEN }}

0 commit comments

Comments
 (0)