This is an automated email from the ASF dual-hosted git repository.

SteNicholas pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/celeborn.git


The following commit(s) were added to refs/heads/main by this push:
     new 671ef2566 [CELEBORN-2328] Auto-apply correctness label from PR 
template checkbox
671ef2566 is described below

commit 671ef2566196ad090a64eebda563f2efc75fb666
Author: Fei Wang <[email protected]>
AuthorDate: Tue May 19 11:48:00 2026 +0800

    [CELEBORN-2328] Auto-apply correctness label from PR template checkbox
    
    ### What changes were proposed in this pull request?
    
    Replace the free-text `Yes/No` comment under "Does this PR resolve a 
correctness bug?" with a single checkbox in the PR template. Add a GitHub 
Actions workflow (`correctness-label.yml`) that automatically adds or removes 
the `correctness` label based on whether the box is checked, triggered on every 
PR open/edit.
    
    ### Why are the changes needed?
    
    Previously the note said "committer will add `correctness` label" — a 
manual step that was easy to miss. This automates it: checking the box applies 
the label immediately, and unchecking it removes the label, with no committer 
action required.
    
    To track all correctness PR: 
https://github.com/apache/celeborn/issues?q=label%3Acorrectness
    ### Does this PR resolve a correctness bug?
    
    - [ ] Yes
    
    ### Does this PR introduce _any_ user-facing change?
    
    No.
    
    ### How was this patch tested?
    
    CI workflow logic verified by code review. End-to-end behavior can be 
confirmed by opening a test PR against the repo and toggling the checkbox.
    
    <img width="1796" height="144" alt="image" 
src="https://github.com/user-attachments/assets/ccd25ac5-1b24-4d8d-ab10-e6df406d2843";
 />
    
    Closes #3688 from turboFei/correctness.
    
    Authored-by: Fei Wang <[email protected]>
    Signed-off-by: SteNicholas <[email protected]>
---
 .github/PULL_REQUEST_TEMPLATE.md |  5 ++++-
 .github/workflows/labeler.yml    | 29 ++++++++++++++++++++++++++++-
 2 files changed, 32 insertions(+), 2 deletions(-)

diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md
index ece816e75..c07fabf9d 100644
--- a/.github/PULL_REQUEST_TEMPLATE.md
+++ b/.github/PULL_REQUEST_TEMPLATE.md
@@ -16,10 +16,13 @@ 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?
 
+<!-- Check if yes. -->
+- [ ] Yes
 
 
 ### How was this patch tested?
diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml
index 696bbcf7a..233022638 100644
--- a/.github/workflows/labeler.yml
+++ b/.github/workflows/labeler.yml
@@ -18,7 +18,8 @@
 #
 name: Pull Request Labeler
 on:
-  - pull_request_target
+  pull_request_target:
+    types: [opened, edited, synchronize, labeled, unlabeled, reopened]
 
 jobs:
   labeler:
@@ -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

Reply via email to