-
Notifications
You must be signed in to change notification settings - Fork 8
33 lines (27 loc) · 963 Bytes
/
sync.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
name: Sync to Organization Repository
# 监听 push 到 main 分支的事件
on:
push:
branches:
- main
jobs:
sync-repo:
runs-on: ubuntu-latest
steps:
# Step 1: Checkout 源仓库的代码
- name: Checkout Source Repository
uses: actions/checkout@v3
# Step 2: 配置 Git 用户信息
- name: Setup Git
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
# Step 3: 添加组织仓库作为远程仓库
- name: Add Organization Repository as Remote
run: |
git remote add target https://x-access-token:${{ secrets.SC_SYNC_TOKEN }}@github.com/RWAWrapper/SmartContract.git
git fetch target
# Step 4: 将代码推送到组织仓库的 main 分支
- name: Push Changes to Organization Repository
run: |
git push target main --force