Fix Gitea push URL token injection for HTTPS

This commit is contained in:
2026-06-12 12:18:29 +02:00
parent 21998b5f2e
commit d57f191ded
5 changed files with 40 additions and 5 deletions
+8 -1
View File
@@ -112,7 +112,14 @@ curl -sS -X POST "$GITEA_URL/api/v1/orgs/$GITEA_ORG/repos" \
-H "Content-Type: application/json" \ -H "Content-Type: application/json" \
-d "{\"name\":\"$APP_ID\",\"private\":false,\"auto_init\":false}" >/dev/null || true -d "{\"name\":\"$APP_ID\",\"private\":false,\"auto_init\":false}" >/dev/null || true
GITEA_PUSH_URL="${GITEA_URL/http:\/\//http:\/\/${GITEA_TOKEN}@}" if [[ "$GITEA_URL" == http://* ]]; then
GITEA_PUSH_URL="${GITEA_URL/http:\/\//http:\/\/${GITEA_TOKEN}@}"
elif [[ "$GITEA_URL" == https://* ]]; then
GITEA_PUSH_URL="${GITEA_URL/https:\/\//https:\/\/${GITEA_TOKEN}@}"
else
echo "Unsupported GITEA_URL: $GITEA_URL"
exit 1
fi
git remote remove origin 2>/dev/null || true git remote remove origin 2>/dev/null || true
git remote add origin "$GITEA_PUSH_URL/$GITEA_ORG/$APP_ID.git" git remote add origin "$GITEA_PUSH_URL/$GITEA_ORG/$APP_ID.git"
git push -u origin main git push -u origin main
+8 -1
View File
@@ -162,7 +162,14 @@ curl -sS -X POST "$GITEA_URL/api/v1/orgs/$GITEA_ORG/repos" \
-H "Content-Type: application/json" \ -H "Content-Type: application/json" \
-d "{\"name\":\"$APP_ID\",\"private\":false,\"auto_init\":false}" >/dev/null || true -d "{\"name\":\"$APP_ID\",\"private\":false,\"auto_init\":false}" >/dev/null || true
GITEA_PUSH_URL="${GITEA_URL/http:\/\//http:\/\/${GITEA_TOKEN}@}" if [[ "$GITEA_URL" == http://* ]]; then
GITEA_PUSH_URL="${GITEA_URL/http:\/\//http:\/\/${GITEA_TOKEN}@}"
elif [[ "$GITEA_URL" == https://* ]]; then
GITEA_PUSH_URL="${GITEA_URL/https:\/\//https:\/\/${GITEA_TOKEN}@}"
else
echo "Unsupported GITEA_URL: $GITEA_URL"
exit 1
fi
git remote remove origin 2>/dev/null || true git remote remove origin 2>/dev/null || true
git remote add origin "$GITEA_PUSH_URL/$GITEA_ORG/$APP_ID.git" git remote add origin "$GITEA_PUSH_URL/$GITEA_ORG/$APP_ID.git"
+8 -1
View File
@@ -133,7 +133,14 @@ curl -sS -X POST "$GITEA_URL/api/v1/orgs/$GITEA_ORG/repos" \
-H "Content-Type: application/json" \ -H "Content-Type: application/json" \
-d "{\"name\":\"$APP_ID\",\"private\":false,\"auto_init\":false}" >/dev/null || true -d "{\"name\":\"$APP_ID\",\"private\":false,\"auto_init\":false}" >/dev/null || true
GITEA_PUSH_URL="${GITEA_URL/http:\/\//http:\/\/${GITEA_TOKEN}@}" if [[ "$GITEA_URL" == http://* ]]; then
GITEA_PUSH_URL="${GITEA_URL/http:\/\//http:\/\/${GITEA_TOKEN}@}"
elif [[ "$GITEA_URL" == https://* ]]; then
GITEA_PUSH_URL="${GITEA_URL/https:\/\//https:\/\/${GITEA_TOKEN}@}"
else
echo "Unsupported GITEA_URL: $GITEA_URL"
exit 1
fi
git remote remove origin 2>/dev/null || true git remote remove origin 2>/dev/null || true
git remote add origin "$GITEA_PUSH_URL/$GITEA_ORG/$APP_ID.git" git remote add origin "$GITEA_PUSH_URL/$GITEA_ORG/$APP_ID.git"
git push -u origin main git push -u origin main
+8 -1
View File
@@ -100,7 +100,14 @@ git config user.name "AppFactory Bot"
git config user.email "appfactory@local" git config user.email "appfactory@local"
git branch -M main git branch -M main
GITEA_PUSH_URL="${GITEA_URL/http:\/\//http:\/\/${GITEA_TOKEN}@}" if [[ "$GITEA_URL" == http://* ]]; then
GITEA_PUSH_URL="${GITEA_URL/http:\/\//http:\/\/${GITEA_TOKEN}@}"
elif [[ "$GITEA_URL" == https://* ]]; then
GITEA_PUSH_URL="${GITEA_URL/https:\/\//https:\/\/${GITEA_TOKEN}@}"
else
echo "Unsupported GITEA_URL: $GITEA_URL"
exit 1
fi
git remote add origin "$GITEA_PUSH_URL/$GITEA_ORG/$APP_ID.git" git remote add origin "$GITEA_PUSH_URL/$GITEA_ORG/$APP_ID.git"
git add . git add .
+8 -1
View File
@@ -88,7 +88,14 @@ curl -sS -X POST "$GITEA_URL/api/v1/orgs/$GITEA_ORG/repos" \
-H "Content-Type: application/json" \ -H "Content-Type: application/json" \
-d "{\"name\":\"$APP_ID\",\"private\":false,\"auto_init\":false}" >/dev/null || true -d "{\"name\":\"$APP_ID\",\"private\":false,\"auto_init\":false}" >/dev/null || true
GITEA_PUSH_URL="${GITEA_URL/http:\/\//http:\/\/${GITEA_TOKEN}@}" if [[ "$GITEA_URL" == http://* ]]; then
GITEA_PUSH_URL="${GITEA_URL/http:\/\//http:\/\/${GITEA_TOKEN}@}"
elif [[ "$GITEA_URL" == https://* ]]; then
GITEA_PUSH_URL="${GITEA_URL/https:\/\//https:\/\/${GITEA_TOKEN}@}"
else
echo "Unsupported GITEA_URL: $GITEA_URL"
exit 1
fi
git remote remove origin 2>/dev/null || true git remote remove origin 2>/dev/null || true
git remote add origin "$GITEA_PUSH_URL/$GITEA_ORG/$APP_ID.git" git remote add origin "$GITEA_PUSH_URL/$GITEA_ORG/$APP_ID.git"
git push -u origin main git push -u origin main