Skip to content

Commit

Permalink
feat: add github action for sync
Browse files Browse the repository at this point in the history
  • Loading branch information
kongtaoxing committed Sep 27, 2024
1 parent e9e0f4f commit 7504337
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/sync.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,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

0 comments on commit 7504337

Please sign in to comment.