Added PR/Issue management actions

This commit is contained in:
2026-02-13 15:52:40 +00:00
parent 97354a2874
commit 07502a6b26
4 changed files with 182 additions and 12 deletions

View File

@@ -49,17 +49,16 @@ jobs:
LABEL_JSON='{ "labels": ["status: needs-rebase"] }'
LABELS_API_URL="$API_BASE_URL/repos/$REPO/issues/$PR_NUMBER/labels"
curl -s -f -X POST -H "Authorization: token $API_TOKEN" -H "Content-Type: application/json" -d "$LABEL_JSON" "$LABELS_API_URL"
- name: Remove 'needs-rebase' label if clean
if: gitea.event.pull_request.merge_status != 'CONFLICT'
run: |
LABEL_TO_REMOVE="status: needs-rebase"
ISSUES_API_URL="$API_BASE_URL/repos/$REPO/issues/$PR_NUMBER"
CURRENT_LABELS_JSON=$(curl -s -H "Authorization: token $API_TOKEN" "$ISSUES_API_URL/labels")
LABEL_ID=$(echo "$CURRENT_LABELS_JSON" | jq --arg name "$LABEL_TO_REMOVE" '.[] | select(.name == $name) | .id')
# Only try to delete the label if we found its ID
if [ -n "$LABEL_ID" ]; then
echo "Found and removing '$LABEL_TO_REMOVE' (ID: $LABEL_ID)..."
curl -s -f -X DELETE -H "Authorization: token $API_TOKEN" "$ISSUES_API_URL/labels/$LABEL_ID"
@@ -68,9 +67,9 @@ jobs:
- name: Auto-assign reviewers
run: |
REVIEWERS_JSON='{ "reviewers": ["psmattas"] }'
if [[ -n "$REVIEWERS_JSON" ]]; then
echo "Requesting review from: $REVIEWERS_JSON"
API_URL="$API_BASE_URL/repos/$REPO/pulls/$PR_NUMBER/requested_reviewers"
curl -s -f -X POST -H "Authorization: token $API_TOKEN" -H "Content-Type: application/json" -d "$REVIEWERS_JSON" "$API_URL"
fi
fi