From fdc2415c1254a6c7a8188299f82a0ffcdbe4993f Mon Sep 17 00:00:00 2001 From: weichengwu Date: Tue, 18 Nov 2025 09:17:56 +0800 Subject: [PATCH] add mirror ci --- .github/workflows/git-mirror.yml | 35 ++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 .github/workflows/git-mirror.yml diff --git a/.github/workflows/git-mirror.yml b/.github/workflows/git-mirror.yml new file mode 100644 index 0000000..044566d --- /dev/null +++ b/.github/workflows/git-mirror.yml @@ -0,0 +1,35 @@ +name: Mirror to smartjingrui's git +on: + push: + branches: [main] + workflow_dispatch: {} + +jobs: + build: + runs-on: + labels: mac-mini-2018 + + steps: + - name: Checkout source repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 # 必须 0,否则无法完整 mirror + + - name: Set up mirror remote (http) + run: | + mirror_url="$(echo "$MIRROR_URL" \ + | sed -E "s#^http://#http://${MIRROR_USERNAME}:${MIRROR_PASSWORD}@#")" + if git remote get-url mirror >/dev/null 2>&1; then + git remote set-url mirror "$mirror_url" + else + git remote add mirror "$mirror_url" + fi + + env: + MIRROR_USERNAME: ${{ secrets.MIRROR_USERNAME }} + MIRROR_PASSWORD: ${{ secrets.MIRROR_PASSWORD }} + MIRROR_URL: http://123.60.153.169:3006/fucai/fucai-claim + + - name: Push to mirror + run: | + git push --mirror mirror \ No newline at end of file