From da4952aaa62219dc407d54c47ba70ab2fffd74a6 Mon Sep 17 00:00:00 2001 From: Tobias Klemp Date: Thu, 1 Jan 2026 23:34:33 +0100 Subject: [PATCH] try using gitea api --- .gitea/actions/getTagSafeRef/action.yml | 31 ++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/.gitea/actions/getTagSafeRef/action.yml b/.gitea/actions/getTagSafeRef/action.yml index 6635a07..d981fcd 100644 --- a/.gitea/actions/getTagSafeRef/action.yml +++ b/.gitea/actions/getTagSafeRef/action.yml @@ -9,11 +9,40 @@ outputs: runs: using: 'composite' steps: + - name: Get PR branch info via Gitea API + if: github.event.issue.pull_request + id: pr-info + shell: bash + run: | + # Use Gitea's API endpoint + PR_URL="${{ github.event.issue.pull_request.url }}" + + # Extract PR info using curl (Gitea API is similar to GitHub) + PR_INFO=$(curl -s -H "Authorization: token ${{ github.token }}" "$PR_URL") + + # Extract branch name from JSON response + BRANCH_NAME=$(echo "$PR_INFO" | jq -r '.head.ref') + + echo "pr_branch=$BRANCH_NAME" >> $GITHUB_OUTPUT + echo "Found PR branch: $BRANCH_NAME" + - name: Create tag safe branch name id: get-branch shell: bash run: | - BRANCH_NAME="${{ github.ref }}" + if [[ "${{ github.event.issue.pull_request }}" != "" && "${{ github.event.issue.pull_request }}" != "null" ]]; then + # This is a PR comment - use the branch we got from API + BRANCH_NAME="${{ steps.pr-info.outputs.pr_branch }}" + echo "Using PR branch: $BRANCH_NAME" + elif [[ "${{ github.head_ref }}" != "" ]]; then + # This is a PR workflow + BRANCH_NAME="${{ github.head_ref }}" + echo "Using head ref: $BRANCH_NAME" + else + # This is a push to main/other branch + BRANCH_NAME="${{ github.ref_name }}" + echo "Using ref name: $BRANCH_NAME" + fi # Clean the branch name for Docker tag compatibility CLEAN_BRANCH=$(echo "$BRANCH_NAME" | sed 's/[^a-zA-Z0-9._-]/-/g' | tr '[:upper:]' '[:lower:]')