fixed action from exiting because a PR already existed.

This commit is contained in:
2026-10-13 07:54:01 +02:00
parent acea5286e8
commit c6ff15f17b
+8 -4
View File
@@ -13,7 +13,6 @@ inputs:
token:
description: "Gitea token with pull-request write access"
required: true
default: ${{ secrets.GITHUB_TOKEN }}
title:
description: "Pull request title"
required: true
@@ -67,9 +66,6 @@ runs:
echo "::notice::Creating pull request ${REPOSITORY}: ${HEAD} -> ${BASE}"
echo "${GITEA_URL}"
echo "${REPOSITORY}"
STATUS="$(
curl -sS -o "$RESPONSE" -w "%{http_code}" \
-X POST \
@@ -82,6 +78,13 @@ runs:
if [ "$STATUS" != 201 ]; then
cat "$RESPONSE"
echo "----"
# Gitea returns 409 when a PR for this head/base is already open.
if jq -e '.message | test("already exists")' "$RESPONSE" >/dev/null; then
echo "::notice::Pull request already exists. Nothing to do."
exit 0
fi
echo "::error::create failed with HTTP ${STATUS}"
exit 1
fi
@@ -91,3 +94,4 @@ runs:
echo "url=$(jq -r '.url' "$RESPONSE")" >> "$GITHUB_OUTPUT"
echo "html_url=$(jq -r '.html_url' "$RESPONSE")" >> "$GITHUB_OUTPUT"
echo "::notice::Pull request #${NUMBER}: $(jq -r '.html_url' "$RESPONSE")"