Search code examples
azerothcore

How to keep fork master branch in sync with azerothcore master branch


How can I automatically keep my fork master branch in sync with the AzerothCore master branch?


Solution

  • You can use GitHub Actions to keep your fork master branch in sync:

    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"
    

    Create the secrets in the fork repo settings. You can refer here on how to add them: https://docs.github.com/en/actions/configuring-and-managing-workflows/creating-and-storing-encrypted-secrets#creating-encrypted-secrets-for-a-repository

    In my case I created the secrets GH_USERNAME and GH_TOKEN

    GH_USERNAME should be set to your github username.

    GH_TOKEN should be set to a personal access token that you create.

    Refer here for information on how to create one: https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token