41 lines
1.1 KiB
YAML
41 lines
1.1 KiB
YAML
name: Sync Upstream and Trigger Build
|
|
|
|
on:
|
|
schedule:
|
|
- cron: "0 0 * * *" # 每天 UTC 时间 0 点检查一次
|
|
workflow_dispatch: # 支持手动触发
|
|
|
|
jobs:
|
|
sync-and-build:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout Fork Code
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0 # 获取完整 Git 历史
|
|
|
|
- name: Add Upstream Remote
|
|
run: |
|
|
git remote add upstream https://github.com/cloudflare/cloudflared.git
|
|
|
|
- name: Fetch Upstream Latest Code
|
|
run: |
|
|
git fetch upstream
|
|
|
|
- name: Merge Upstream Code to Local Branch
|
|
run: |
|
|
git merge upstream/master --no-edit # 假设上游主分支是 master
|
|
# 如果有冲突,这里会失败(需手动处理)
|
|
|
|
- name: Push Updates to Fork Repository
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.TOKEN }}
|
|
run: |
|
|
git push origin master
|
|
|
|
- name: Trigger Build Workflow
|
|
uses: benc-uk/workflow-dispatch@v1
|
|
with:
|
|
workflow: build-release.yml # 你的编译工作流文件名
|
|
token: ${{ secrets.TOKEN }}
|