如何使fork master分支与azerothcore master分支保持同步

问题描述

如何自动使fork主分支与AzerothCore主分支保持同步?

解决方法

您可以使用GitHub Actions来使fork master分支保持同步:

on:
  schedule:
    - cron: "0 */6 * * *"
jobs:
  repo-sync:
    runs-on: ubuntu-latest
    steps:
    - name: repo-sync
      uses: wei/git-sync@v2
      with:
        source_repo: "https://github.com/azerothcore/azerothcore-wotlk.git"
        source_branch: "master"
        destination_repo: "https://${{ secrets.GH_USERNAME }}:${{ secrets.GH_TOKEN }}@github.com/${{ secrets.GH_USERNAME }}/azerothcore-wotlk.git"
        destination_branch: "master"

在fork仓库设置中创建机密。您可以在这里参考如何添加它们: https://docs.github.com/en/actions/configuring-and-managing-workflows/creating-and-storing-encrypted-secrets#creating-encrypted-secrets-for-a-repository

就我而言,我创建了秘密GH_USERNAMEGH_TOKEN

GH_USERNAME应该设置为您的github用户名。

GH_TOKEN应该设置为您创建的个人访问令牌。

有关如何创建一个的信息,请参见此处: https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token