FIX: INTERNAL_ERROR in checkout
All checks were successful
PR Management Bot / pr-bot (pull_request) Successful in 14s
PR Title Checker / Validate PR Title Format (pull_request) Successful in 2s

- Grep Exit Code: In the Auto-label step, if grep finds no matching commit types, it exits with code 1. Since workflows run with set -e, this will cause the job to fail immediately if no labels are found.
- Self-Review Request: In the Auto-assign reviewers step, you are hardcoding psmattas as a reviewer. Since psmattas is also the author (based on the logs), the API will return a 422 Unprocessable Entity error because an author cannot review their own PR.
This commit is contained in:
2026-02-16 11:18:13 +00:00
parent 08bb82b7ae
commit 4aca6997ff

View File

@@ -16,8 +16,9 @@ jobs:
PR_AUTHOR: ${{ gitea.actor }}
steps:
# FIX 1: Use standard short syntax to avoid upstream gitea.com connection errors
- name: Check out repository
uses: https://gitea.com/actions/checkout@v4
uses: actions/checkout@v4
with:
fetch-depth: 0
@@ -25,8 +26,15 @@ jobs:
run: |
API_URL="$API_BASE_URL/repos/$REPO/pulls/$PR_NUMBER/commits"
MESSAGES=$(curl -s -H "Authorization: token $API_TOKEN" "$API_URL" | jq -r '.[].commit.message')
UNIQUE_TYPES=$(echo "$MESSAGES" | grep -oP '^EC-\d+: \K(FEAT|FIX|DOCS|STYLE|REFACTOR|PERF|TEST|CHORE)' | sort -u)
if [[ -z "$UNIQUE_TYPES" ]]; then exit 0; fi
# FIX 2: Added '|| true' to prevent failure if no matches are found (grep returns 1 on no match)
UNIQUE_TYPES=$(echo "$MESSAGES" | grep -oP '^EC-\d+: \K(FEAT|FIX|DOCS|STYLE|REFACTOR|PERF|TEST|CHORE)' | sort -u || true)
if [[ -z "$UNIQUE_TYPES" ]]; then
echo "No semantic commit types found."
exit 0
fi
LABELS_JSON=$(echo "$UNIQUE_TYPES" | jq -R '("type: " + (. | ascii_downcase))' | jq -s '{"labels": .}')
ISSUES_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 "$LABELS_JSON" "$ISSUES_API_URL"
@@ -66,10 +74,15 @@ jobs:
- name: Auto-assign reviewers
run: |
REVIEWERS_JSON='{ "reviewers": ["psmattas"] }'
target_reviewer="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"
# FIX 3: Check if the author is the target reviewer to avoid API error (422)
if [[ "$PR_AUTHOR" == "$target_reviewer" ]]; then
echo "Author is $target_reviewer. Skipping self-review request."
exit 0
fi
REVIEWERS_JSON="{\"reviewers\": [\"$target_reviewer\"]}"
echo "Requesting review from: $target_reviewer"
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"