Skip to content

Sy-Update

Sy-Update #8

Workflow file for this run

# 此代码可应用与所有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: Set up Git user
run: |
git config --local user.email "[email protected]"
git config --local user.name "yunshuangqwq"
# 添加上游信息
- 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: Commit and push changes
run: |
git add README.md
git commit -m "Update" || echo "No changes to commit"
git push origin master --force
-d '{"ref": "main"}'