Schedule Update #8
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Schedule Update | |
on: | |
schedule: | |
- cron: "0 0 * * 0" # 每週日晚上 12:00 UTC | |
workflow_dispatch: # 支援手動觸發 | |
jobs: | |
update: | |
name: Update Resources | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v3 | |
with: | |
ref: develop | |
- name: Setup Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: "22" | |
- name: Install dependencies | |
run: npm install | |
- name: Run download script | |
run: npm run download | |
- name: Commit changes | |
run: | | |
git config --global user.name 'github-actions[bot]' | |
git config --global user.email 'github-actions[bot]@users.noreply.github.com' | |
git add . | |
git reset package-lock.json | |
if git diff-index --quiet HEAD --; then | |
echo "No changes to commit" | |
else | |
git commit -m 'Scheduled resource update' | |
git push origin develop | |
fi | |
- name: Merge develop into master | |
if: ${{ !github.event.inputs || github.event.inputs.force || github.ref == 'refs/heads/develop' }} | |
run: | | |
git fetch origin | |
git checkout master | |
git merge origin/develop | |
git push origin master | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |