From 78ebde441fe4863e74429dc5c849e1089e6e7a63 Mon Sep 17 00:00:00 2001 From: Junwang Zhao Date: Thu, 3 Dec 2026 14:43:26 +0800 Subject: [PATCH 1/4] ci: add and validate a pull request template Reviewers need to know who is affected by a change, why it is needed, and how the author tested it. When that context is missing, reviewers have to piece it together from the diff or ask for it during review. Ask authors to provide that context, disclose how they used AI, and indicate who reviewed the PR before submission. Check for missing answers so authors can fill them in before a reviewer picks up the PR. Community discussion: https://lists.apache.org/thread/tj5spv4w2xzbommyqrqvf5347y024h47 --- .github/pull_request_template.md | 26 ++++++++++ .github/workflows/pr-description.yml | 74 ++++++++++++++++++++++++++++ 2 files changed, 100 insertions(+) create mode 100644 .github/pull_request_template.md create mode 100644 .github/workflows/pr-description.yml diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 000000000..1db561dc2 --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,26 @@ +## Problem + + + +## Changes + + + +## Testing + + + +## AI disclosure + + + +## Reviewed before submission by + + + +- [ ] Human +- [ ] AI +- [ ] Not reviewed diff --git a/.github/workflows/pr-description.yml b/.github/workflows/pr-description.yml new file mode 100644 index 000000000..df230bd2f --- /dev/null +++ b/.github/workflows/pr-description.yml @@ -0,0 +1,74 @@ +# 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: PR description + +on: + pull_request: + types: [opened, edited, reopened, synchronize, ready_for_review] + +permissions: {} + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number }} + cancel-in-progress: true + +jobs: + check-description: + if: ${{ !github.event.pull_request.draft && github.event.pull_request.user.login != 'dependabot[bot]' }} + runs-on: ubuntu-slim + steps: + - name: Check required sections + shell: python + run: | + import json + import os + import re + import sys + + with open(os.environ["GITHUB_EVENT_PATH"]) as event: + body = json.load(event)["pull_request"]["body"] or "" + body = re.sub(r"|\Z)", "", body, flags=re.DOTALL) + + filled = set() + review_section = "Reviewed before submission by" + reviewed_by = set() + section = None + fence = "" + for line in body.splitlines(): + marker = re.match(r"^ {0,3}(`{3,}|~{3,})(.*)$", line) + if marker and not fence: + fence = marker[1] + elif marker and marker[1].startswith(fence) and not marker[2].strip(): + fence = "" + elif not fence and (heading := re.fullmatch(r" {0,3}##[ \t]+(.+)", line)): + section = re.sub(r"[ \t]+#+$", "", heading[1].strip()) + elif section == review_section: + choice = re.fullmatch(r" {0,3}[-*+] +\[[xX]\] +(Human|AI|Not reviewed)[ \t]*", line) + if not fence and choice: + reviewed_by.add(choice[1]) + elif section and line.strip(): + filled.add(section) + + required = ["Problem", "Changes", "Testing", "AI disclosure"] + missing = [section for section in required if section not in filled] + if not reviewed_by: + missing.append(f"{review_section} (check at least one option)") + if missing: + sys.exit("Please fill in these sections in the PR description: " + ", ".join(missing)) + if "Not reviewed" in reviewed_by and len(reviewed_by) > 1: + sys.exit('Select "Not reviewed" only when neither Human nor AI is checked.') From a543a123a7e7d5fb196df51205b416353b27bf65 Mon Sep 17 00:00:00 2001 From: Zhao Junwang Date: Thu, 3 Dec 2026 23:53:25 +0800 Subject: [PATCH 2/4] ci: use descriptive questions in the PR template --- .github/pull_request_template.md | 23 +++++------------------ .github/workflows/pr-description.yml | 9 +++++++-- 2 files changed, 12 insertions(+), 20 deletions(-) diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 1db561dc2..875f08fe0 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -1,25 +1,12 @@ -## Problem +## What problem does this PR solve, and who is affected? - +## What changed, including any breaking API changes or critical fixes? -## Changes +## How did you test this change? - +## Was AI used for this PR? If so, how? -## Testing - - - -## AI disclosure - - - -## Reviewed before submission by - - +## Who reviewed this PR before submission (including self-review)? - [ ] Human - [ ] AI diff --git a/.github/workflows/pr-description.yml b/.github/workflows/pr-description.yml index df230bd2f..d1429358a 100644 --- a/.github/workflows/pr-description.yml +++ b/.github/workflows/pr-description.yml @@ -45,7 +45,7 @@ jobs: body = re.sub(r"|\Z)", "", body, flags=re.DOTALL) filled = set() - review_section = "Reviewed before submission by" + review_section = "Who reviewed this PR before submission (including self-review)?" reviewed_by = set() section = None fence = "" @@ -64,7 +64,12 @@ jobs: elif section and line.strip(): filled.add(section) - required = ["Problem", "Changes", "Testing", "AI disclosure"] + required = [ + "What problem does this PR solve, and who is affected?", + "What changed, including any breaking API changes or critical fixes?", + "How did you test this change?", + "Was AI used for this PR? If so, how?", + ] missing = [section for section in required if section not in filled] if not reviewed_by: missing.append(f"{review_section} (check at least one option)") From 46007af603cdf76259dc5f12c005aaf9293cd7aa Mon Sep 17 00:00:00 2001 From: Junwang Zhao Date: Fri, 4 Dec 2026 17:38:30 +0800 Subject: [PATCH 3/4] Update .github/pull_request_template.md Co-authored-by: Gang Wu --- .github/pull_request_template.md | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 875f08fe0..6b18131ea 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -1,13 +1,26 @@ -## What problem does this PR solve, and who is affected? + -## How did you test this change? +### Rationale for this change -## Was AI used for this PR? If so, how? +### What changes are included in this PR? -## Who reviewed this PR before submission (including self-review)? +### Are these changes tested? + +### Are there any user-facing changes? + +### Was AI used for this PR? + + + +**Reviewed by:** - [ ] Human - [ ] AI - [ ] Not reviewed + From d5442c33c4bb2536faa7fbd48971e86c47282ab9 Mon Sep 17 00:00:00 2001 From: Zhao Junwang Date: Fri, 4 Dec 2026 20:24:56 +0800 Subject: [PATCH 4/4] ci: remove trailing blank line from PR template --- .github/pull_request_template.md | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 6b18131ea..e1375fdce 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -23,4 +23,3 @@ In accordance to the [Guidelines for AI-assisted Contributions](https://iceberg. - [ ] Human - [ ] AI - [ ] Not reviewed -