Skip to content
Open
Show file tree
Hide file tree
Changes from 5 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?

Expand Down
49 changes: 49 additions & 0 deletions .github/workflows/correctness-label.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
name: Correctness Label

on:
pull_request_target:
types: [opened, edited, synchronize]

jobs:
label:
runs-on: ubuntu-latest
permissions:
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