diff --git a/.github/workflows/sync.yml b/.github/workflows/sync.yml new file mode 100644 index 0000000..600679f --- /dev/null +++ b/.github/workflows/sync.yml @@ -0,0 +1,31 @@ +name: Sync from Gitea repository + +on: + schedule: + - cron: '0 * * * *' # 每小时运行一次 + workflow_dispatch: # 手动触发 + +jobs: + sync: + runs-on: ubuntu-latest + + steps: + - name: Checkout this repository + uses: actions/checkout@v2 + with: + persist-credentials: false + + - name: Configure Git + run: | + git config --global user.name "github-actions[bot]" + git config --global user.email "github-actions[bot]@users.noreply.github.com" + + - name: Clone Gitea repository + run: | + git clone --mirror https://${{ secrets.GITEA_REPO }}:${{ secrets.GITEA_TOKEN }}@gitea.snat.top/seesharper/SageTools.git gitea_repo + + - name: Sync changes to GitHub + run: | + cd gitea_repo + git remote set-url --push origin https://${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git + git push --mirror