Skip to content

Commit 9228efe

Browse files
authored
Add GitHub Actions workflow to sync fork from upstream
1 parent 92a6f95 commit 9228efe

1 file changed

Lines changed: 37 additions & 0 deletions

File tree

.github/workflows/main.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Sync fork from upstream
2+
3+
on:
4+
schedule:
5+
- cron: "0 3 * * *" # 每天 03:00 UTC,可改
6+
workflow_dispatch:
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
sync:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout fork
16+
uses: actions/checkout@v4
17+
with:
18+
ref: main
19+
fetch-depth: 0
20+
21+
- name: Configure git
22+
run: |
23+
git config user.name "github-actions[bot]"
24+
git config user.email "github-actions[bot]@users.noreply.github.com"
25+
26+
- name: Add upstream and fetch
27+
run: |
28+
git remote add upstream https://github.com/TOZHR/grok2api.git
29+
git fetch upstream
30+
31+
- name: Merge upstream/main into main
32+
run: |
33+
git merge --ff-only upstream/main || git merge upstream/main
34+
35+
- name: Push changes
36+
run: |
37+
git push origin main

0 commit comments

Comments
 (0)