cs-self-learning/.github/workflows/sync-upstream.yml
likanug fb184a4050
chore: Change sync schedule to 3:00 UTC+8
Updated cron schedule for daily sync to  3:00 UTC+8.
2025-12-10 19:28:44 +08:00

49 lines
1.3 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

name: Sync Upstream
on:
workflow_dispatch: # 手动触发
schedule:
- cron: "0 19 * * *" # 每天(utc+8)凌晨3点自动同步可自行设置
permissions:
contents: write
jobs:
sync:
runs-on: ubuntu-latest
steps:
- name: Checkout your repository
uses: actions/checkout@v4
with:
fetch-depth: 0 # 必须拉取完整历史
token: ${{ secrets.GITHUB_TOKEN }}
# 配置 Git 信息
- name: Configure Git
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
# 添加 upstream如果不存在
- name: Add upstream remote
run: |
git remote add upstream https://github.com/PKUFlyingPig/cs-self-learning || true
git fetch upstream
# # 方法1merge推荐最稳定
# - name: Merge upstream into main
# run: |
# git checkout master
# git merge upstream/master --no-edit || true
# 方法2rebase更干净的历史
- name: Rebase onto upstream
run: |
git checkout master
git rebase upstream/master || true
# 推送到你的仓库
- name: Push changes
run: |
git push origin master