添加流水线
Some checks failed
阿里云仓库同步流水线(强制同步/镜像模式) / sync-repositories (push) Has been cancelled
BladeX仓库同步流水线 / sync-repositories (push) Successful in 28m1s
阿里云仓库合并流水线(合并模式) / merge-repositories (push) Successful in 1m13s

This commit is contained in:
2025-12-25 10:06:05 +08:00
parent 989dd10aef
commit cb22214784
3 changed files with 378 additions and 1 deletions

View File

@@ -0,0 +1,57 @@
name: 阿里云仓库合并流水线(合并模式)
# 注意此workflow使用合并模式git merge --no-ff会保留目标仓库的更改历史
# 如果遇到合并冲突,会跳过该仓库并继续处理其他仓库
# 如果需要强制同步(镜像模式),请使用 aliyun-repo-sync.yml workflow
on:
push:
branches:
- master
paths:
- 'aliyun_repos.yaml'
- '.gitea/workflows/aliyun-repo-merge.yml'
workflow_dispatch:
schedule:
# 每天凌晨2点执行
- cron: '0 2 * * 0'
env:
CONFIG_FILE: 'aliyun_repos.yaml'
jobs:
merge-repositories:
runs-on: ubuntu-latest
steps:
- name: 签出配置仓库
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: 配置 Git
run: |
git config --global user.name "gitea-runner"
git config --global user.email "actions@gitea.fjy8018.top"
git config --global init.defaultBranch master
- name: 安装依赖
run: |
apt-get update
apt-get install -y python3-yaml jq
- name: 验证配置文件
run: |
if [ ! -f "${{ env.CONFIG_FILE }}" ]; then
echo "错误: 配置文件 ${{ env.CONFIG_FILE }} 不存在!"
exit 1
fi
echo "✓ 配置文件已找到"
- name: 从配置文件中提取仓库并合并
env:
UPSTREAM_USERNAME: ${{ secrets.CODEUP_USERNAME }}
UPSTREAM_TOKEN: ${{ secrets.CODEUP_PASSWORD }}
TARGET_USERNAME: ${{ secrets.TARGET_USERNAME }}
TARGET_TOKEN: ${{ secrets.TARGET_TOKEN }}
run: python3 merge_repos.py

View File

@@ -1,4 +1,7 @@
name: 阿里云仓库同步流水线
name: 阿里云仓库同步流水线(强制同步/镜像模式)
# 注意此workflow使用强制同步模式git reset --hard会覆盖目标仓库的所有更改
# 如果需要使用合并模式merge --no-ff请使用 aliyun-repo-merge.yml workflow
on:
push: