Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ Thanks for sending a pull request! Here are some tips for you:

### Does this PR resolve a correctness bug?

<!-- Yes/No. (Note: If yes, committer will add `correctness` label to current pull request). -->
<!-- Check if yes. The `correctness` label will be added/removed automatically. -->
- [ ] Yes

### Does this PR introduce _any_ user-facing change?
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this also use - [ ] Yes. for Does this PR introduce _any_ user-facing change?


Expand Down
29 changes: 28 additions & 1 deletion .github/workflows/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
#
name: Pull Request Labeler
on:
- pull_request_target
pull_request_target:
types: [opened, edited, synchronize, labeled, unlabeled, reopened]

jobs:
labeler:
Expand All @@ -31,3 +32,29 @@ jobs:
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
sync-labels: true

correctness-label:
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- name: Apply or remove correctness label
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR_BODY: ${{ github.event.pull_request.body }}
PR_NUMBER: ${{ github.event.pull_request.number }}
REPO: ${{ github.repository }}
run: |
# Extract only the correctness section (up to the next ### heading).
# PR_BODY is passed via env so it never touches the shell command string.
section=$(printf '%s' "$PR_BODY" | awk '
/Does this PR resolve a correctness bug/ { found=1 }
found && /^###/ && !/Does this PR resolve/ { exit }
found { print }
')
if printf '%s' "$section" | grep -iqE -- '^\s*-\s*\[\s*[xX]\s*\]\s*yes\s*$'; then
gh pr edit "$PR_NUMBER" --repo "$REPO" --add-label "correctness"
else
gh pr edit "$PR_NUMBER" --repo "$REPO" --remove-label "correctness" 2>/dev/null || true
fi
Loading