1.新建仓库

2.点击Action

3.复制复制代码修改

# File: .github/workflows/repo-sync.yml
name: 自动同步
on:
  schedule:
    - cron: '0 4,16  * * *'
  workflow_dispatch:
  watch:
    types: started
  repository_dispatch:
    types: repo-sync
jobs:
  repo-sync:
    env:
      PAT: ${{ github.event.client_payload.PAT || secrets.PAT }} #此处PAT需要申请,教程详见:https://www.jianshu.com/p/bb82b3ad1d11
      dst_key: ${{ secrets.GITEE_PRIVATE_KEY }} # 我自己同步到gitee使用,其他人可忽略
    runs-on: ubuntu-latest
    if: github.event.repository.owner.id == github.event.sender.id
    steps:
      - uses: actions/checkout@v2
        with:
          persist-credentials: false

      - name: 开始A自动同步
        uses: repo-sync/github-sync@v2
        if: env.PAT
        with:
          source_repo: "https://github.com/shuye73/MyActions.git"   #此处修改
          source_branch: "main"
          destination_branch: "main"
          github_token: ${{ github.event.client_payload.PAT || secrets.PAT }}

4.申请Token
https://github.com/settings/apps

Personal access tokens -- Generate new token

Note 随便输入(方便辨别的)

勾选:repo workflow

5.进入Settings--secrets 新建 New repository secret

Name 输入PAT

Value输入申请的token