Harden crawler deploy rollback #8280
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |