|
10 | 10 | # 每天UTC 2:30执行(避开高峰期) |
11 | 11 | - cron: '30 2 * * *' |
12 | 12 | workflow_dispatch: # 允许手动触发 |
| 13 | + inputs: |
| 14 | + skip_update: |
| 15 | + description: Skip update check and force skip all operations |
| 16 | + required: false |
| 17 | + default: 'false' |
| 18 | + type: boolean |
| 19 | + force_update: |
| 20 | + description: Force update even if no changes detected |
| 21 | + required: false |
| 22 | + default: 'false' |
| 23 | + type: boolean |
13 | 24 |
|
14 | 25 | jobs: |
15 | 26 | auto-update: |
@@ -45,13 +56,38 @@ jobs: |
45 | 56 | - name: Check if update is needed |
46 | 57 | id: check-update |
47 | 58 | run: | |
48 | | - # 使用TypeScript脚本进行哈希差异检查,避免shell参数过长问题 |
49 | | - if pnpm run diff-hash; then |
50 | | - echo "No update needed, content hash is the same" |
51 | | - echo "skip=true" >> $GITHUB_OUTPUT |
| 59 | + # 检查触发方式和用户输入参数 |
| 60 | + if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then |
| 61 | + echo "Manual trigger detected" |
| 62 | +
|
| 63 | + # 检查用户是否选择跳过更新 |
| 64 | + if [ "${{ github.event.inputs.skip_update }}" = "true" ]; then |
| 65 | + echo "User chose to skip update check, skipping all operations" |
| 66 | + echo "skip=true" >> $GITHUB_OUTPUT |
| 67 | + elif [ "${{ github.event.inputs.force_update }}" = "true" ]; then |
| 68 | + echo "User chose to force update, skipping hash check" |
| 69 | + echo "skip=false" >> $GITHUB_OUTPUT |
| 70 | + else |
| 71 | + echo "User chose default behavior, checking for updates..." |
| 72 | + # 使用TypeScript脚本进行哈希差异检查,避免shell参数过长问题 |
| 73 | + if pnpm run diff-hash; then |
| 74 | + echo "No update needed, content hash is the same" |
| 75 | + echo "skip=true" >> $GITHUB_OUTPUT |
| 76 | + else |
| 77 | + echo "Update needed, content hash is different or error occurred" |
| 78 | + echo "skip=false" >> $GITHUB_OUTPUT |
| 79 | + fi |
| 80 | + fi |
52 | 81 | else |
53 | | - echo "Update needed, content hash is different or error occurred" |
54 | | - echo "skip=false" >> $GITHUB_OUTPUT |
| 82 | + echo "Scheduled trigger detected, checking for updates..." |
| 83 | + # 使用TypeScript脚本进行哈希差异检查,避免shell参数过长问题 |
| 84 | + if pnpm run diff-hash; then |
| 85 | + echo "No update needed, content hash is the same" |
| 86 | + echo "skip=true" >> $GITHUB_OUTPUT |
| 87 | + else |
| 88 | + echo "Update needed, content hash is different or error occurred" |
| 89 | + echo "skip=false" >> $GITHUB_OUTPUT |
| 90 | + fi |
55 | 91 | fi |
56 | 92 |
|
57 | 93 | - name: Fetch USB IDs |
|
0 commit comments