From 4a4e8ab77f0b219ee8b9f24963e6e5efc6fc4bbb Mon Sep 17 00:00:00 2001 From: Alex Lebens Date: Sun, 30 Nov 2025 16:41:11 -0600 Subject: [PATCH] use jq --- .gitea/workflows/render-manifests.yaml | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/.gitea/workflows/render-manifests.yaml b/.gitea/workflows/render-manifests.yaml index 3ce320831..bcb816375 100644 --- a/.gitea/workflows/render-manifests.yaml +++ b/.gitea/workflows/render-manifests.yaml @@ -138,34 +138,35 @@ jobs: GITEA_URL: ${{ secrets.REPO_URL }} HEAD_BRANCH: ${{ steps.commit-push.outputs.HEAD_BRANCH }} run: | + apt install jq + API_ENDPOINT="${GITEA_URL}/api/v1/repos/${{ gitea.repository_owner }}/${{ gitea.repository_name }}/pulls" - PAYLOAD=$(cat <<-EOF - { - "head": "${HEAD_BRANCH}", - "base": "${BASE_BRANCH}", - "title": "Automated Manifest Update: $(date +%F)", - "body": "This PR contains newly rendered Kubernetes manifests automatically generated by the CI workflow.", - } - EOF - ) + PAYLOAD=$( jq -n \ + --arg head "${HEAD_BRANCH}" \ + --arg base "${BASE_BRANCH}" \ + --arg title "Automated Manifest Update: $(date +%F)" \ + --arg body "This PR contains newly rendered Kubernetes manifests automatically generated by the CI workflow" \ + '{head: $head, base: $base, title: $title}, body: $body' ) echo ">> Creating PR from branch: ${HEAD_BRANCH} into ${BASE_BRANCH}" + echo ">> With Payload of:" + echo "$PAYLOAD" HTTP_STATUS=$( curl -X POST \ - --write-out '%{http_code}' \ --silent \ + --write-out '%{http_code}' \ --output /tmp/pr_response \ + --data "${PAYLOAD}" \ -H "Authorization: token ${GITEA_TOKEN}" \ -H "Content-Type: application/json" \ - --data "${PAYLOAD}" \ "${API_ENDPOINT}" ) echo ">> Gitea API Response Body ..." echo "----" - echo "$(cat /tmp/pr_response)" + cat /tmp/pr_response echo "----" if [ "$HTTP_STATUS" == "201" ]; then