fix: github token #2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.GITHUB_TOKEN }}@github.com/RWAWrapper/SmartContract.git | |
git fetch target | |
# Step 4: 将代码推送到组织仓库的 main 分支 | |
- name: Push Changes to Organization Repository | |
run: | | |
git push target main --force |