From 13725c08410fcecca520d5cb786271fd1883f937 Mon Sep 17 00:00:00 2001 From: Janis Date: Thu, 30 Apr 2026 18:08:48 +0200 Subject: [PATCH] feat(delete-pr-branch): enhance API base URL resolution in branch deletion workflow --- .github/workflows/delete-pr-branch.yml | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/.github/workflows/delete-pr-branch.yml b/.github/workflows/delete-pr-branch.yml index 533f17d..83a8695 100644 --- a/.github/workflows/delete-pr-branch.yml +++ b/.github/workflows/delete-pr-branch.yml @@ -22,10 +22,24 @@ jobs: TOKEN: ${{ secrets.GITEA_TOKEN }} REPOSITORY: ${{ github.repository }} BRANCH: ${{ github.event.pull_request.head.ref }} - API_BASE: ${{ GITHUB_API_URL }} run: | set -euo pipefail + API_BASE="${GITHUB_API_URL:-}" + if [ -z "${API_BASE}" ]; then + SERVER_URL="${GITHUB_SERVER_URL:-}" + if [ -z "${SERVER_URL}" ]; then + echo "Unable to resolve Gitea API base URL from GITHUB_API_URL or GITHUB_SERVER_URL" + exit 1 + fi + API_BASE="${SERVER_URL%/}/api/v1" + fi + + if [ -z "${API_BASE}" ]; then + echo "Unable to resolve Gitea API base URL" + exit 1 + fi + # Branch names commonly include '/'; encode it for the API path segment. BRANCH_ENCODED="${BRANCH//\//%2F}" URL="${API_BASE}/repos/${REPOSITORY}/branches/${BRANCH_ENCODED}"