更新 update.yml #15
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
# 此代码可应用与所有github项目(不包维护失效了自行更改代码) | ||
name: Sy-Update | ||
on: | ||
workflow_dispatch: | ||
jobs: | ||
sync-and-update: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
# 添加上游信息 | ||
- name: Add upstream repository | ||
run: git remote add upstream https://github.com/x-dr/telegraph-Image.git | ||
#获取所有分支信息 | ||
- name: Fetch all upstream branches | ||
run: git fetch upstream | ||
# 检出上游仓库的更改并忽略.github文件夹(我是直接删除当前仓库的数据注意保留)然后更新合并 | ||
- name: Checkout upstream changes excluding .github | ||
run: | | ||
git checkout upstream/main -- . | ||
git reset -- .github | ||
- name: Clean untracked files, preserving .github directory | ||
run: | | ||
git clean -fdx -e .github | ||
# 设置账号信息 | ||
- name: Set up Git user | ||
run: | | ||
git config --local user.email "[email protected]" | ||
git config --local user.name "yunshuangqwq" | ||
# 给README.md一个更新让cf自动部署 | ||
- name: Commit and push changes | ||
run: | | ||
git add README.md README.md | ||
git commit -m "Update ck" || echo "No changes to commit" | ||
git push origin main --force | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
-d '{"ref": "main"}' | ||