This commit is contained in:
@@ -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:]')
|
||||
|
||||
Reference in New Issue
Block a user