fix: use encoded forgejo remote for sync
Some checks failed
build-and-push / build (push) Failing after 41s
Some checks failed
build-and-push / build (push) Failing after 41s
This commit is contained in:
parent
4fc874a44b
commit
3c437b61b3
1 changed files with 9 additions and 4 deletions
13
.github/workflows/sync-to-forgejo.yml
vendored
13
.github/workflows/sync-to-forgejo.yml
vendored
|
|
@ -28,13 +28,18 @@ 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; }
|
||||||
|
|
||||||
AUTH="$(printf '%s' "${FORGEJO_USERNAME}:${FORGEJO_SECRET}" | base64 -w0)"
|
ENCODED_PASSWORD="$(python3 - <<'PY'
|
||||||
TARGET="https://ci.nxtgauge.com/${FORGEJO_OWNER}/${REPO}.git"
|
import os
|
||||||
|
import urllib.parse
|
||||||
|
print(urllib.parse.quote(os.environ['FORGEJO_SECRET'], safe=''))
|
||||||
|
PY
|
||||||
|
)"
|
||||||
|
TARGET="https://${FORGEJO_USERNAME}:${ENCODED_PASSWORD}@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 -c http.extraHeader="AUTHORIZATION: basic ${AUTH}" push forgejo "HEAD:${BRANCH}" --force
|
git push forgejo "HEAD:${BRANCH}" --force
|
||||||
git -c http.extraHeader="AUTHORIZATION: basic ${AUTH}" push forgejo --tags --force
|
git push forgejo --tags --force
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue