Merge branch 'main' of https://github.com/oiov/wr.do
This commit is contained in:
@@ -0,0 +1,124 @@
|
||||
name: 上游同步 | Upstream Sync
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
issues: write
|
||||
actions: write
|
||||
pull-requests: write
|
||||
|
||||
on:
|
||||
# 默认关闭自动同步,仅支持手动触发
|
||||
# schedule:
|
||||
# - cron: '0 */6 * * *' # every 6 hours
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
add_comment:
|
||||
description: '是否在同步后添加评论 | Add comment after sync'
|
||||
required: false
|
||||
default: true
|
||||
type: boolean
|
||||
|
||||
jobs:
|
||||
sync_latest_from_upstream:
|
||||
name: 同步上游最新提交 | Sync latest commits from upstream repo
|
||||
runs-on: ubuntu-latest
|
||||
if: ${{ github.event.repository.fork }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: 清理失败通知 | Clean issue notice
|
||||
uses: actions-cool/issues-helper@v3
|
||||
with:
|
||||
actions: 'close-issues'
|
||||
labels: '🚨 Sync Fail'
|
||||
|
||||
- name: 同步上游变更 | Sync upstream changes
|
||||
id: sync
|
||||
uses: aormsby/Fork-Sync-With-Upstream-action@v3.4
|
||||
with:
|
||||
upstream_sync_repo: oiov/wr.do
|
||||
upstream_sync_branch: main
|
||||
target_sync_branch: main
|
||||
target_repo_token: ${{ secrets.GITHUB_TOKEN }} # automatically generated, no need to set
|
||||
test_mode: false
|
||||
|
||||
- name: 获取最新提交信息 | Get latest commit info
|
||||
if: success()
|
||||
id: commit_info
|
||||
run: |
|
||||
# 获取最新的 commit SHA 和信息
|
||||
LATEST_COMMIT=$(git rev-parse HEAD)
|
||||
COMMIT_MESSAGE=$(git log -1 --pretty=format:"%s")
|
||||
COMMIT_AUTHOR=$(git log -1 --pretty=format:"%an")
|
||||
SYNC_TIME=$(date -u +"%Y-%m-%d %H:%M:%S UTC")
|
||||
|
||||
echo "latest_commit=$LATEST_COMMIT" >> $GITHUB_OUTPUT
|
||||
echo "commit_message=$COMMIT_MESSAGE" >> $GITHUB_OUTPUT
|
||||
echo "commit_author=$COMMIT_AUTHOR" >> $GITHUB_OUTPUT
|
||||
echo "sync_time=$SYNC_TIME" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: 添加同步评论 | Add sync comment to commit
|
||||
if: success() && github.event.inputs.add_comment == 'true'
|
||||
uses: actions/github-script@v7
|
||||
with:
|
||||
script: |
|
||||
const commitSha = '${{ steps.commit_info.outputs.latest_commit }}';
|
||||
const syncTime = '${{ steps.commit_info.outputs.sync_time }}';
|
||||
const commitMsg = '${{ steps.commit_info.outputs.commit_message }}';
|
||||
const commitAuthor = '${{ steps.commit_info.outputs.commit_author }}';
|
||||
|
||||
const commentBody = `## 🔄 同步成功 | Sync Successful
|
||||
|
||||
**同步时间 | Sync Time:** ${syncTime}
|
||||
**源仓库 | Source Repository:** [oiov/wr.do](https://github.com/oiov/wr.do)
|
||||
**同步分支 | Sync Branch:** main → main
|
||||
**最新提交 | Latest Commit:** ${commitMsg}
|
||||
**提交作者 | Commit Author:** ${commitAuthor}
|
||||
|
||||
---
|
||||
*此评论由 GitHub Actions 自动生成 | This comment was automatically generated by GitHub Actions*`;
|
||||
|
||||
try {
|
||||
await github.rest.repos.createCommitComment({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
commit_sha: commitSha,
|
||||
body: commentBody
|
||||
});
|
||||
console.log('✅ 成功添加同步评论到 commit:', commitSha);
|
||||
} catch (error) {
|
||||
console.log('❌ 添加评论失败:', error.message);
|
||||
}
|
||||
|
||||
- name: 同步检查 | Sync check
|
||||
if: failure()
|
||||
uses: actions-cool/issues-helper@v3
|
||||
with:
|
||||
actions: 'create-issue'
|
||||
title: '🚨 同步失败 | Sync Fail'
|
||||
labels: '🚨 Sync Fail'
|
||||
body: |
|
||||
## 同步失败详情 | Sync Failure Details
|
||||
|
||||
**失败时间 | Failure Time:** ${{ steps.commit_info.outputs.sync_time || 'Unknown' }}
|
||||
**源仓库 | Source Repository:** [oiov/wr.do](https://github.com/oiov/wr.do)
|
||||
**目标分支 | Target Branch:** main
|
||||
**工作流运行 | Workflow Run:** [${{ github.run_id }}](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})
|
||||
|
||||
### 可能的原因 | Possible Causes:
|
||||
- 上游仓库的 workflow 文件发生变更
|
||||
- 存在合并冲突
|
||||
- 网络连接问题
|
||||
- 权限不足
|
||||
|
||||
### 解决方案 | Solutions:
|
||||
1. 手动执行 Sync Fork 操作
|
||||
2. 检查是否存在合并冲突
|
||||
3. 重新运行此工作流
|
||||
|
||||
---
|
||||
Due to a change in the workflow file of the [oiov/wr.do](https://github.com/oiov/wr.do) upstream repository, GitHub has automatically suspended the scheduled automatic update. You need to manually sync your fork.
|
||||
|
||||
由于 [oiov/wr.do](https://github.com/oiov/wr.do) 上游仓库的 workflow 文件变更,导致 GitHub 自动暂停了本次自动更新,你需要手动 Sync Fork 一次。
|
||||
|
||||
+51
-1
@@ -145,6 +145,56 @@ pnpm dev
|
||||
- Vercel 作为推荐的部署平台
|
||||
- Resend 作为邮件服务
|
||||
|
||||
## Fork 仓库同步
|
||||
|
||||
本项目配置了与上游仓库 [oiov/wr.do](https://github.com/oiov/wr.do) 的同步工作流,支持:
|
||||
|
||||
- 🔄 **手动触发同步** - 默认关闭自动同步,完全控制同步时机
|
||||
- 💬 **同步后自动评论** - 在相关 commit 上添加详细的同步信息
|
||||
- 🚨 **智能错误处理** - 同步失败时自动创建详细的 Issue
|
||||
- 🧹 **自动清理通知** - 自动关闭之前的同步失败 Issue
|
||||
|
||||
### 如何手动触发同步
|
||||
|
||||
#### 方法 1: 通过 GitHub Web 界面
|
||||
1. 进入仓库的 **Actions** 页面
|
||||
2. 在左侧选择 **"上游同步 | Upstream Sync"** 工作流
|
||||
3. 点击 **"Run workflow"** 按钮
|
||||
4. 选择是否在同步后添加评论(默认开启)
|
||||
5. 点击 **"Run workflow"** 确认执行
|
||||
|
||||
#### 方法 2: 通过 GitHub CLI
|
||||
```bash
|
||||
# 安装并登录 GitHub CLI
|
||||
gh auth login
|
||||
|
||||
# 触发同步工作流
|
||||
gh workflow run "上游同步 | Upstream Sync" --repo your-username/wr.do
|
||||
|
||||
# 查看工作流运行状态
|
||||
gh run list --workflow="上游同步 | Upstream Sync" --repo your-username/wr.do
|
||||
```
|
||||
|
||||
### 同步状态查看
|
||||
|
||||
- **工作流历史**: 在 Actions 页面查看 "上游同步 | Upstream Sync" 工作流的运行记录
|
||||
- **同步评论**: 同步成功后会在最新 commit 上添加包含同步时间、源仓库信息等的评论
|
||||
- **错误报告**: 同步失败时会自动创建包含详细错误信息和解决方案的 Issue
|
||||
|
||||
### 常见问题解决
|
||||
|
||||
**合并冲突**: 如遇到合并冲突,需要手动解决:
|
||||
```bash
|
||||
git clone https://github.com/your-username/wr.do.git
|
||||
cd wr.do
|
||||
git remote add upstream https://github.com/oiov/wr.do.git
|
||||
git fetch upstream
|
||||
git merge upstream/main
|
||||
# 解决冲突后提交并推送
|
||||
```
|
||||
|
||||
**权限问题**: 确保仓库的 Actions 权限已启用,并在设置中允许 GitHub Actions 创建和批准 pull requests。
|
||||
|
||||
## 社区群组
|
||||
|
||||
- Discord: https://discord.gg/AHPQYuZu3m
|
||||
@@ -164,4 +214,4 @@ pnpm dev
|
||||
<source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/svg?repos=oiov/wr.do&type=Date" />
|
||||
<img alt="Star History Chart" src="https://api.star-history.com/svg?repos=oiov/wr.do&type=Date" />
|
||||
</picture>
|
||||
</a>
|
||||
</a>
|
||||
|
||||
@@ -150,6 +150,59 @@ Via [Installation For Developer](https://wr.do/docs/developer).
|
||||
- Vercel as the recommended deployment platform
|
||||
- Resend as the primary email service
|
||||
|
||||
## Fork Repository Sync
|
||||
|
||||
This project is configured with a sync workflow for the upstream repository [oiov/wr.do](https://github.com/oiov/wr.do), featuring:
|
||||
|
||||
- 🔄 **Manual Sync Trigger** - Auto-sync disabled by default, full control over sync timing
|
||||
- 💬 **Auto Comment After Sync** - Add detailed sync information to related commits
|
||||
- 🚨 **Smart Error Handling** - Auto-create detailed Issues when sync fails
|
||||
- 🧹 **Auto Cleanup Notifications** - Automatically close previous sync failure Issues
|
||||
|
||||
### How to Manually Trigger Sync
|
||||
|
||||
#### Method 1: Via GitHub Web Interface
|
||||
|
||||
1. Go to the repository's **Actions** page
|
||||
2. Select **"上游同步 | Upstream Sync"** workflow from the left sidebar
|
||||
3. Click **"Run workflow"** button
|
||||
4. Choose whether to add comments after sync (enabled by default)
|
||||
5. Click **"Run workflow"** to confirm execution
|
||||
|
||||
#### Method 2: Via GitHub CLI
|
||||
|
||||
```bash
|
||||
# Install and login to GitHub CLI
|
||||
gh auth login
|
||||
|
||||
# Trigger sync workflow
|
||||
gh workflow run "上游同步 | Upstream Sync" --repo your-username/wr.do
|
||||
|
||||
# Check workflow run status
|
||||
gh run list --workflow="上游同步 | Upstream Sync" --repo your-username/wr.do
|
||||
```
|
||||
|
||||
### Checking Sync Status
|
||||
|
||||
- **Workflow History**: View "上游同步 | Upstream Sync" workflow run records in Actions page
|
||||
- **Sync Comments**: After successful sync, comments with sync time, source repo info, etc. are added to the latest commit
|
||||
- **Error Reports**: When sync fails, detailed Issues with error information and solutions are automatically created
|
||||
|
||||
### Troubleshooting
|
||||
|
||||
**Merge Conflicts**: If you encounter merge conflicts, manual resolution is required:
|
||||
|
||||
```bash
|
||||
git clone https://github.com/your-username/wr.do.git
|
||||
cd wr.do
|
||||
git remote add upstream https://github.com/oiov/wr.do.git
|
||||
git fetch upstream
|
||||
git merge upstream/main
|
||||
# Resolve conflicts, then commit and push
|
||||
```
|
||||
|
||||
**Permission Issues**: Ensure repository Actions permissions are enabled and "Allow GitHub Actions to create and approve pull requests" is enabled in settings.
|
||||
|
||||
## Community Group
|
||||
|
||||
- Discord: https://discord.gg/AHPQYuZu3m
|
||||
|
||||
Reference in New Issue
Block a user