From d6f342619bf82caa3bd7d25ae19a1543d6a99ae4 Mon Sep 17 00:00:00 2001 From: YaKun9 <131952790+YaKun9@users.noreply.github.com> Date: Wed, 12 Jun 2024 16:08:17 +0800 Subject: [PATCH] Create sync.yml --- .github/workflows/sync.yml | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 .github/workflows/sync.yml 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