From fd35d5cdb9283a65ec34d2010cd9ec1562f15c98 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Thu, 27 Nov 2025 10:52:29 -0600 Subject: tweak mirror --- .github/workflows/mirror.yml | 56 ++++++++++++++++++++++++++++++-------------- 1 file changed, 38 insertions(+), 18 deletions(-) (limited to '.github/workflows') diff --git a/.github/workflows/mirror.yml b/.github/workflows/mirror.yml index 3747426b..132c4d7c 100644 --- a/.github/workflows/mirror.yml +++ b/.github/workflows/mirror.yml @@ -7,6 +7,25 @@ on: delete: branches: - '**' # Trigger when branches are deleted + workflow_dispatch: # Allow manual triggering from GitHub UI + inputs: + target: + description: 'Target to mirror to' + required: false + default: 'all' + type: choice + options: + - all + - GitLab + - Codeberg + delay: + description: 'Delay in seconds before mirroring' + required: false + default: '0' + +concurrency: + group: mirror-sync + cancel-in-progress: false jobs: mirror: @@ -23,7 +42,13 @@ jobs: fail-fast: false # Continue with other mirrors even if one fails steps: + - name: Wait for things to settle + run: | + echo "⏳ Waiting 15 seconds..." + sleep 15 + - name: Checkout repository + if: github.event_name != 'delete' # Skip checkout for delete events uses: actions/checkout@v4 with: fetch-depth: 0 # Fetch full history for proper mirroring @@ -57,21 +82,16 @@ jobs: - name: Mirror to ${{ matrix.target.name }} run: | - echo "🔄 Syncing to ${{ matrix.target.name }}..." - # Add remote with SSH - git remote add mirror ${{ matrix.target.repo }} - - # Push all branches and tags - git push mirror --all --force - git push mirror --tags --force - - echo "✅ Successfully synced to ${{ matrix.target.name }}" - - - name: Handle branch deletion on ${{ matrix.target.name }} - if: github.event_name == 'delete' && github.event.ref_type == 'branch' - run: | - DELETED_BRANCH="${{ github.event.ref }}" - echo "🗑️ Branch '$DELETED_BRANCH' was deleted, syncing deletion to ${{ matrix.target.name }}..." - - # Delete branch from mirror - git push ${{ matrix.target.repo }} --delete "$DELETED_BRANCH" || echo "Branch may not exist on ${{ matrix.target.name }}" \ No newline at end of file + echo "🔄 Mirroring repository to ${{ matrix.target.name }}..." + + # Clone the GitHub repository as a mirror (bare repo with all refs) + git clone --mirror https://github.com/${{ github.repository }}.git mirror-repo + cd mirror-repo + + # Set the push URL to the target repository + git remote set-url --push origin ${{ matrix.target.repo }} + + # Push everything to the mirror (handles all branches, tags, and deletions) + git push --mirror + + echo "✅ Successfully mirrored to ${{ matrix.target.name }}" \ No newline at end of file -- cgit v1.2.3 From b0175a8980e4201535df2cf14fdd84cf9e857efc Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Thu, 27 Nov 2025 10:57:17 -0600 Subject: mirror tweak --- .github/workflows/mirror.yml | 28 +--------------------------- 1 file changed, 1 insertion(+), 27 deletions(-) (limited to '.github/workflows') diff --git a/.github/workflows/mirror.yml b/.github/workflows/mirror.yml index 132c4d7c..ed94f14a 100644 --- a/.github/workflows/mirror.yml +++ b/.github/workflows/mirror.yml @@ -7,21 +7,7 @@ on: delete: branches: - '**' # Trigger when branches are deleted - workflow_dispatch: # Allow manual triggering from GitHub UI - inputs: - target: - description: 'Target to mirror to' - required: false - default: 'all' - type: choice - options: - - all - - GitLab - - Codeberg - delay: - description: 'Delay in seconds before mirroring' - required: false - default: '0' + workflow_dispatch: concurrency: group: mirror-sync @@ -42,18 +28,6 @@ jobs: fail-fast: false # Continue with other mirrors even if one fails steps: - - name: Wait for things to settle - run: | - echo "⏳ Waiting 15 seconds..." - sleep 15 - - - name: Checkout repository - if: github.event_name != 'delete' # Skip checkout for delete events - uses: actions/checkout@v4 - with: - fetch-depth: 0 # Fetch full history for proper mirroring - token: ${{ secrets.GITHUB_TOKEN }} - - name: Configure SSH env: SSH_KEY: ${{ secrets.GIT_MIRROR_SSH_KEY }} -- cgit v1.2.3 From c6e374fe2c192dfea167eb81994f745f8f2177c9 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Thu, 27 Nov 2025 11:29:36 -0600 Subject: mirror tweak again --- .github/workflows/mirror.yml | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) (limited to '.github/workflows') diff --git a/.github/workflows/mirror.yml b/.github/workflows/mirror.yml index ed94f14a..2bf5578c 100644 --- a/.github/workflows/mirror.yml +++ b/.github/workflows/mirror.yml @@ -54,18 +54,12 @@ jobs: git config --global user.name "GitHub Actions" git config --global user.email "actions@github.com" + - name: Check out GitHub Repository + run: | + git clone --mirror git@github.com:slskd/slskd + git for-each-ref --format="delete %(refname)" refs/pull refs/original | git update-ref --stdin + - name: Mirror to ${{ matrix.target.name }} run: | - echo "🔄 Mirroring repository to ${{ matrix.target.name }}..." - - # Clone the GitHub repository as a mirror (bare repo with all refs) - git clone --mirror https://github.com/${{ github.repository }}.git mirror-repo - cd mirror-repo - - # Set the push URL to the target repository - git remote set-url --push origin ${{ matrix.target.repo }} - - # Push everything to the mirror (handles all branches, tags, and deletions) - git push --mirror - - echo "✅ Successfully mirrored to ${{ matrix.target.name }}" \ No newline at end of file + git remote add mirror ${{ matrix.target.repo }} + git push --mirror mirror \ No newline at end of file -- cgit v1.2.3 From 5ccb3d1350f466b6c3f8ff00791cc56dafd3a4c5 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Thu, 27 Nov 2025 11:43:08 -0600 Subject: mirror --- .github/workflows/mirror.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to '.github/workflows') diff --git a/.github/workflows/mirror.yml b/.github/workflows/mirror.yml index 2bf5578c..3a949fb8 100644 --- a/.github/workflows/mirror.yml +++ b/.github/workflows/mirror.yml @@ -55,8 +55,12 @@ jobs: git config --global user.email "actions@github.com" - name: Check out GitHub Repository + uses: actions/checkout@v6 + with: + fetch-depth: 0 + + - name: Clean up hidden GitHub refs run: | - git clone --mirror git@github.com:slskd/slskd git for-each-ref --format="delete %(refname)" refs/pull refs/original | git update-ref --stdin - name: Mirror to ${{ matrix.target.name }} -- cgit v1.2.3 From 23c16c7cc029341fcce54dcf81c857b113768491 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Thu, 27 Nov 2025 17:56:03 -0600 Subject: mirror again --- .github/workflows/mirror.yml | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to '.github/workflows') diff --git a/.github/workflows/mirror.yml b/.github/workflows/mirror.yml index 3a949fb8..0d11a6b7 100644 --- a/.github/workflows/mirror.yml +++ b/.github/workflows/mirror.yml @@ -54,16 +54,12 @@ jobs: git config --global user.name "GitHub Actions" git config --global user.email "actions@github.com" - - name: Check out GitHub Repository - uses: actions/checkout@v6 - with: - fetch-depth: 0 - - - name: Clean up hidden GitHub refs + - name: Check out repo run: | - git for-each-ref --format="delete %(refname)" refs/pull refs/original | git update-ref --stdin + git clone --bare https://github.com/slskd/slskd slskd - name: Mirror to ${{ matrix.target.name }} + working-directory: ./slskd run: | git remote add mirror ${{ matrix.target.repo }} git push --mirror mirror \ No newline at end of file -- cgit v1.2.3 From 8792e614e7c3b181bdb37bb6b94bce08f04ab256 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Thu, 27 Nov 2025 18:29:03 -0600 Subject: mirror? --- .github/workflows/mirror.yml | 1 + 1 file changed, 1 insertion(+) (limited to '.github/workflows') diff --git a/.github/workflows/mirror.yml b/.github/workflows/mirror.yml index 0d11a6b7..f3aaa95f 100644 --- a/.github/workflows/mirror.yml +++ b/.github/workflows/mirror.yml @@ -1,6 +1,7 @@ name: Mirror Repository on: + create: push: branches: - '**' # Trigger on push to any branch -- cgit v1.2.3