commit
Delete .github/workflows/codeberg.yml
diff --git a/.github/workflows/codeberg.yml b/.github/workflows/codeberg.yml
deleted file mode 100644
index 1c9b47b..0000000
--- a/.github/workflows/codeberg.yml
+++ /dev/null
@@ -1,92 +0,0 @@
-# Mirror GitHub -> Codeberg backup
-name: Codeberg
-
-on:
- push:
- branches:
- - main
-
-jobs:
- mirror:
- if: github.repository == 'doughmination/sandrone'
- runs-on: ubuntu-latest
-
- permissions:
- contents: read
-
- concurrency:
- group: mirror-${{ github.repository }}
- cancel-in-progress: false
-
- env:
- CODEBERG_HOST: codeberg.org
- CODEBERG_USERNAME: ${{ secrets.CODEBERG_USERNAME }}
- CODEBERG_REPO: ${{ secrets.CODEBERG_REPO }}
- CODEBERG_TOKEN: ${{ secrets.CODEBERG_TOKEN }}
-
- steps:
- - name: Clone repository as a mirror
- env:
- SOURCE_TOKEN: ${{ github.token }}
- SERVER_URL: ${{ github.server_url }}
- run: |
- set -euo pipefail
-
- sourceHost="${SERVER_URL#https://}"
-
- git clone --mirror \
- "https://x-access-token:${SOURCE_TOKEN}@${sourceHost}/${GITHUB_REPOSITORY}.git" \
- source.git
-
- - name: Remove GitHub pull-request refs
- working-directory: source.git
- run: |
- set -euo pipefail
-
- # GitHub creates refs/pull/<number>/head and
- # refs/pull/<number>/merge for pull requests.
- #
- # These are GitHub-specific and Codeberg rejects them
- # as hidden refs, so they are intentionally excluded
- # from the Codeberg backup.
-
- while IFS= read -r ref; do
- [ -z "$ref" ] && continue
-
- echo "Removing $ref"
- git update-ref -d "$ref"
- done < <(
- git for-each-ref --format='%(refname)' 'refs/pull/'
- )
-
- - name: Push mirror to Codeberg
- working-directory: source.git
- run: |
- set -euo pipefail
-
- if [ -z "$CODEBERG_USERNAME" ]; then
- echo "CODEBERG_USERNAME is not set" >&2
- exit 1
- fi
-
- if [ -z "$CODEBERG_REPO" ]; then
- echo "CODEBERG_REPO is not set" >&2
- exit 1
- fi
-
- if [ -z "$CODEBERG_TOKEN" ]; then
- echo "CODEBERG_TOKEN is not set" >&2
- exit 1
- fi
-
- targetUrl="https://${CODEBERG_HOST}/${CODEBERG_USERNAME}/${CODEBERG_REPO}.git"
-
- echo "Mirroring ${GITHUB_REPOSITORY} -> ${targetUrl}"
-
- git remote add mirror "$targetUrl"
-
- # Credentials are supplied through a helper so the token
- # is not written into .git/config.
- git -c credential.helper= \
- -c "credential.helper=!f() { echo username=\"\$CODEBERG_USERNAME\"; echo password=\"\$CODEBERG_TOKEN\"; }; f" \
- push --mirror mirror