feat : Add logic to update PR comments and labels based on CI results
Some checks failed
ansible-lint / Ansible Lint (push) Failing after 7s
Gitleaks Scan / gitleaks (push) Successful in 5s
ai-reviews / Review PR (pull_request) Successful in 18s
Markdown Lint / markdown-lint (push) Successful in 5s
PR check / Gitleaks (pull_request) Successful in 4s
PR check / lint tests (pull_request) Failing after 8s
PR check / handle_failures (pull_request) Successful in 2s
PR check / handle_success (pull_request) Has been skipped

This commit introduces new functionality that updates pull request comments and labels automatically based on the outcomes of continuous integration tests. This enhances the efficiency and visibility of the review process by providing immediate feedback directly within the PR interface.
This commit is contained in:
2026-02-14 11:58:22 +01:00
parent 18e0ed96ea
commit 5ff377223a

View File

@@ -147,6 +147,12 @@ jobs:
-H "Content-Type: application/json" \
-d "{\"body\":\"<!--ci-failed-comment-->\n$COMMENT_BODY\"}" \
"$API/issues/$PR/comments/$EXISTING_COMMENT_ID"
else
curl -s -X POST \
-H "Authorization: token $TOKEN" \
-H "Content-Type: application/json" \
-d "$COMMENT_PAYLOAD" \
"$API/issues/$PR/comments"
fi
# Remove label if exists
@@ -157,6 +163,16 @@ jobs:
"$API/issues/$PR/labels/ci-failed"
fi
# Add ci-pass if not present
if ! echo "$LABELS" | grep -q "^ci-pass$"; then
echo "Adding ci-pass label"
curl -s -X POST \
-H "Authorization: token $TOKEN" \
-H "Content-Type: application/json" \
-d '{"labels":["ci-pass"]}' \
"$API/issues/$PR/labels"
fi
# Reopen PR if closed
PR_STATE=$(curl -s -H "Authorization: token $TOKEN" "$API/pulls/$PR" | jq -r '.state')
if [ "$PR_STATE" = "closed" ]; then