Update .gitea/workflows/opencode.yml
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 3s
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 3s
This commit is contained in:
@@ -312,11 +312,36 @@ jobs:
|
||||
echo "Nessuna PR o nessuna review da postare."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Il verdetto guida lo stato nativo della review.
|
||||
if grep -q 'VERDICT: PASS' /tmp/review.txt; then
|
||||
EVENT="APPROVE"
|
||||
else
|
||||
EVENT="REQUEST_CHANGES"
|
||||
fi
|
||||
|
||||
BODY=$(jq -Rs . < /tmp/review.txt) # encoding JSON-safe del testo review
|
||||
curl -s -X POST "$API/pulls/$PR_NUMBER/reviews" \
|
||||
-H "Authorization: token $GITEA_TOKEN" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "{\"body\":$BODY,\"event\":\"COMMENT\"}" >/dev/null || true
|
||||
|
||||
post_review() {
|
||||
curl -s -o /tmp/review_resp.json -w '%{http_code}' \
|
||||
-X POST "$API/pulls/$PR_NUMBER/reviews" \
|
||||
-H "Authorization: token $GITEA_TOKEN" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "{\"body\":$BODY,\"event\":\"$1\"}"
|
||||
}
|
||||
|
||||
CODE=$(post_review "$EVENT")
|
||||
echo "Review '$EVENT' -> HTTP $CODE"
|
||||
|
||||
# Gitea rifiuta APPROVE/REQUEST_CHANGES sulla PR di cui il bot è autore:
|
||||
# in quel caso ripiega su un commento di review (event=COMMENT).
|
||||
if [ "$CODE" -ge 300 ]; then
|
||||
echo "Fallback a event=COMMENT (probabile self-review su PR del bot). Risposta:"
|
||||
cat /tmp/review_resp.json 2>/dev/null || true
|
||||
echo
|
||||
CODE=$(post_review "COMMENT")
|
||||
echo "Review 'COMMENT' -> HTTP $CODE"
|
||||
fi
|
||||
|
||||
- name: Reazione finale 🚀
|
||||
if: success() && steps.react.outputs.path != ''
|
||||
|
||||
Reference in New Issue
Block a user