fix(ci): use auth header for forgejo sync
Some checks failed
build-and-release / build (push) Failing after 5s

This commit is contained in:
Ashwin Kumar Sivakumar 2026-06-14 19:02:05 +05:30
parent a4c74f39ed
commit 0c1215e9db

View file

@ -28,13 +28,13 @@ jobs:
set -euo pipefail set -euo pipefail
test -n "${FORGEJO_SECRET:-}" || { echo "FORGEJO_SECRET is empty"; exit 1; } test -n "${FORGEJO_SECRET:-}" || { echo "FORGEJO_SECRET is empty"; exit 1; }
ENCODED_PASSWORD="$(printf '%s' "${FORGEJO_SECRET}" | jq -sRr @uri)" AUTH="$(printf '%s' "${FORGEJO_USERNAME}:${FORGEJO_SECRET}" | base64 -w0)"
TARGET="https://${FORGEJO_USERNAME}:${ENCODED_PASSWORD}@ci.nxtgauge.com/${FORGEJO_OWNER}/${REPO}.git" TARGET="https://ci.nxtgauge.com/${FORGEJO_OWNER}/${REPO}.git"
git config user.name "github-actions[bot]" git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com" git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git remote remove forgejo 2>/dev/null || true git remote remove forgejo 2>/dev/null || true
git remote add forgejo "${TARGET}" git remote add forgejo "${TARGET}"
git push forgejo "HEAD:${BRANCH}" --force git -c http.extraHeader="AUTHORIZATION: basic ${AUTH}" push forgejo "HEAD:${BRANCH}" --force
git push forgejo --tags --force git -c http.extraHeader="AUTHORIZATION: basic ${AUTH}" push forgejo --tags --force