Skip to content

Harden crawler deploy rollback #8280

Harden crawler deploy rollback

Harden crawler deploy rollback #8280

name: Label rejected requests
on:
issue_comment:
types: [created]
jobs:
label:
runs-on: ubuntu-latest
if: contains(github.event.comment.body, '<!-- validation-failed:')
permissions:
issues: write
steps:
- name: Extract reason and apply label
env:
GH_TOKEN: ${{ github.token }}
COMMENT_ID: ${{ github.event.comment.id }}
ISSUE: ${{ github.event.issue.number }}
REPO: ${{ github.repository }}
run: |
# Fetch comment body via API so user-provided text never enters this shell script through workflow expressions.
BODY=$(gh api "repos/$REPO/issues/comments/$COMMENT_ID" --jq '.body')
REASON=$(echo "$BODY" | grep -oP '<!-- validation-failed: \K[a-z-]+')
if [ -n "$REASON" ]; then
gh issue edit "$ISSUE" -R "$REPO" --add-label "$REASON"
gh issue close "$ISSUE" -R "$REPO" \
--comment "Closed: rejected as **$REASON** by automated validation."
fi