mirror of
https://github.com/chenyme/grok2api.git
synced 2026-12-05 16:02:12 +00:00
fix: Remove automated upstream sync workflow from GitHub Actions
This commit is contained in:
1 parent
5551f9c0cf
commit
73d2bf6ba6
1 file changed
-66
@@ -1,66 +0,0 @@
|
||||
name: 自动同步上游
|
||||
|
||||
on:
|
||||
schedule:
|
||||
# 每天 UTC 02:00(北京时间 10:00)自动同步
|
||||
- cron: '0 2 * * *'
|
||||
workflow_dispatch: # 允许手动触发
|
||||
|
||||
jobs:
|
||||
sync:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout 代码
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
token: ${{ secrets.PAT_TOKEN }}
|
||||
fetch-depth: 0
|
||||
|
||||
- name: 配置 Git 用户
|
||||
run: |
|
||||
git config user.name "github-actions[bot]"
|
||||
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
||||
|
||||
- name: 同步上游 chenyme/grok2api
|
||||
run: |
|
||||
echo "🔄 开始同步上游仓库..."
|
||||
git remote add upstream https://github.com/chenyme/grok2api.git || true
|
||||
git fetch upstream
|
||||
|
||||
echo "📊 上游新提交:"
|
||||
git log --oneline main..upstream/main | head -10 || echo "无新提交"
|
||||
|
||||
echo "🔀 合并上游代码..."
|
||||
if git merge upstream/main --no-edit; then
|
||||
echo "✅ 合并成功"
|
||||
git push origin main
|
||||
echo "🚀 已推送到 GitHub"
|
||||
else
|
||||
echo "❌ 合并失败,可能有冲突"
|
||||
git merge --abort
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: 生成同步报告
|
||||
if: success()
|
||||
run: |
|
||||
echo "## ✅ 同步成功" >> $GITHUB_STEP_SUMMARY
|
||||
echo "" >> $GITHUB_STEP_SUMMARY
|
||||
echo "**上游仓库**: chenyme/grok2api" >> $GITHUB_STEP_SUMMARY
|
||||
echo "**同步时间**: $(date +'%Y-%m-%d %H:%M:%S UTC')" >> $GITHUB_STEP_SUMMARY
|
||||
echo "" >> $GITHUB_STEP_SUMMARY
|
||||
echo "### 新增提交" >> $GITHUB_STEP_SUMMARY
|
||||
git log --oneline HEAD~5..HEAD >> $GITHUB_STEP_SUMMARY || true
|
||||
|
||||
- name: 同步失败通知
|
||||
if: failure()
|
||||
uses: actions/github-script@v7
|
||||
with:
|
||||
script: |
|
||||
github.rest.issues.create({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
title: '⚠️ 上游同步失败 - ' + new Date().toISOString().split('T')[0],
|
||||
body: `## 同步失败报告\n\n**失败时间**: ${new Date().toISOString()}\n**Workflow 运行**: ${context.payload.repository.html_url}/actions/runs/${context.runId}\n\n### 可能原因\n\n- 存在代码冲突需要手动解决\n- 上游仓库暂时不可访问\n- 网络连接问题\n\n### 建议操作\n\n1. 查看 [Actions 日志](${context.payload.repository.html_url}/actions/runs/${context.runId}) 了解详细错误\n2. 如果是冲突,可能需要本地手动合并\n3. 如果是临时性问题,可以稍后手动重新触发 workflow`
|
||||
})
|
||||
Reference in new issue
Block a user