From 2b888046eb0e649ee93041428bd4c020e213d11e Mon Sep 17 00:00:00 2001 From: Alex Lebens Date: Tue, 2 Dec 2025 18:03:22 -0600 Subject: [PATCH] update endpoint to check --- .gitea/workflows/render-manifests.yaml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.gitea/workflows/render-manifests.yaml b/.gitea/workflows/render-manifests.yaml index fc3625124..1170595c0 100644 --- a/.gitea/workflows/render-manifests.yaml +++ b/.gitea/workflows/render-manifests.yaml @@ -209,7 +209,7 @@ jobs: run: | cd ${MANIFEST_DIR} - API_ENDPOINT="${GITEA_URL}/api/v1/repos/${{ gitea.repository }}/pulls/${BASE_BRANCH}/${HEAD_BRANCH}" + API_ENDPOINT="${GITEA_URL}/api/v1/repos/${{ gitea.repository }}/pulls?base_branch=${BASE_BRANCH}&state=open&page=1" echo ">> Checking if PR from branch ${HEAD_BRANCH} into ${BASE_BRANCH}" echo ">> With Endpoint of:" @@ -242,6 +242,10 @@ jobs: echo "pull-request-exists=${PR_INDEX}" >> $GITEA_OUTPUT echo "pull-request-index=true" >> $GITEA_OUTPUT + if [ "$HTTP_STATUS" == "200" ] && [ "$(cat response_body.json | jq -r .state)" == "closed" ]; then + echo ">> Pull Request found, but was closed" + echo "pull-request-exists=false" >> $GITEA_OUTPUT + else echo ">> Pull Request not found" echo "pull-request-exists=false" >> $GITEA_OUTPUT @@ -304,6 +308,9 @@ jobs: elif [ "$HTTP_STATUS" == "422" ]; then echo ">> Failed to create PR (HTTP 422: Unprocessable Entity), PR may already exist" + elif [ "$HTTP_STATUS" == "409" ]; then + echo ">> Failed to create PR (HTTP 409: Conflict), PR already exists" + else echo ">> Failed to create PR, HTTP status code: $HTTP_STATUS" exit 1