commit
Fix Codeberg mirror workflow rejecting PR refs
git clone --mirror pulls GitHub's synthetic refs/pull/*/head refs, which Codeberg rejects as writes to a hidden ref namespace, failing the whole push even though main mirrors fine. Drop those refs before pushing the mirror. Co-Authored-By: Claude Sonnet 5 <[email protected]>
diff --git a/.github/workflows/codeberg.yml b/.github/workflows/codeberg.yml
index bb00a1a..81b9e32 100644
--- a/.github/workflows/codeberg.yml
+++ b/.github/workflows/codeberg.yml
@@ -56,6 +56,12 @@ jobs:
git remote add mirror "$targetUrl"
+ # GitHub's synthetic refs/pull/* refs live in a hidden namespace on
+ # Codeberg/Gitea and are always rejected, so drop them before mirroring.
+ for ref in $(git for-each-ref --format='%(refname)' 'refs/pull/*'); do
+ git update-ref -d "$ref"
+ done
+
# Credentials go through a helper so the token never lands in .git/config
git -c credential.helper= \
-c "credential.helper=!f() { echo username=\"\$CODEBERG_USERNAME\"; echo password=\"\$CODEBERG_TOKEN\"; }; f" \