forked from OneDragon-Anything/ZenlessZoneZero-OneDragon
-
Notifications
You must be signed in to change notification settings - Fork 0
57 lines (48 loc) · 1.5 KB
/
Copy pathupdate-redemption-code.yml
File metadata and controls
57 lines (48 loc) · 1.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
name: Update Redemption Codes
on:
schedule:
# 每天晚上9点运行(北京时间 UTC+8,即 UTC 13:00)
- cron: '0 13 * * *'
workflow_dispatch: # 允许手动触发
jobs:
set-timestamp:
uses: ./.github/workflows/common-set-timestamp.yml
update-redemption-codes:
needs: set-timestamp
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pyyaml
- name: Run update redemption codes script
run: |
python tools/ci/update_redemption_code.py
- name: Check for changes
id: changes
run: |
if git diff --quiet config/redemption_codes.sample.yml; then
echo "changed=false" >> $GITHUB_OUTPUT
else
echo "changed=true" >> $GITHUB_OUTPUT
fi
- name: Push changes
if: steps.changes.outputs.changed == 'true'
uses: actions-js/push@v1.5
with:
rebase: true
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.head_ref || github.ref_name }}
message: |
ci: 自动更新兑换码 ${{ needs.set-timestamp.outputs.build_timestamp }}
[skip ci]