-
Notifications
You must be signed in to change notification settings - Fork 16
Check PR checklist on PR #357
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 3 commits
37ff975
35e7541
e1637e5
5dca85b
8e0ac9d
5e51dd2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| name: PR Checklist | ||
|
|
||
| on: | ||
| pull_request: | ||
| types: [opened, edited, reopened, synchronize] | ||
| workflow_call: | ||
|
|
||
| jobs: | ||
| check-pr-template: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Check PR body | ||
| env: | ||
| PR_BODY: ${{ github.event.pull_request.body }} | ||
| run: | | ||
| require() { | ||
| if ! grep -qE -- "$1" <<< "$PR_BODY"; then | ||
| echo "::error::$2" | ||
| exit 1 | ||
| fi | ||
| } | ||
|
|
||
| require "^[[:space:]]*## PR Checklist:" \ | ||
| "Could not find the BeeWare PR checklist in the pull request comment. This probably means you've used a tool to submit your PR, rather than the GitHub UI. The BeeWare project provides, and requires the use of a standard template for all PRs. Your PR will be ignored until/unless you add the required components of the template. See https://beeware.org/contributing/guide/how/submit-pr/ for details." | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This link isn't helpful, because it doesn't mention the template anywhere. And even if it did, the user still doesn't have any easy way to restore the template if they deleted it before submitting the PR. Can we include a link to the template content in the .github repository, along with instructions for how to edit the PR's top comment to include it?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would we like an edit to that page or another? CONTRIBUTING.md in the repo has the template I believe.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, we should probably update the contribution guide to make it clear that you must keep the template and follow its instructions, and to provide a link to its source in case they've already deleted it. But I don't think the guide should go into any detail about the template content, because the template should be self-explanatory, and we want to keep the flexibility to update it whenever we want.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've just pushed beeware/beeware-docs-tools#231 to address this need. |
||
|
|
||
| require "^[[:space:]]*- \[\s*[xX]\s*\] I will abide by the BeeWare Code of Conduct" \ | ||
| "The 'Code of Conduct' checkbox in the PR checklist must be checked." | ||
|
|
||
| require "^[[:space:]]*- \[\s*[xX]\s*\] I have read and have followed the \*\*CONTRIBUTING.md\*\* file" \ | ||
| "The 'CONTRIBUTING.md' checkbox in the PR checklist must be checked." | ||
|
|
||
| if grep -qE -- "^[[:space:]]*- \[\s*[xX]\s*\] This PR was generated or assisted using an AI tool" <<< "$PR_BODY"; then | ||
| require "^[[:space:]]*(-\s+)?Assisted-by:" "'Assisted-by:' line is missing." | ||
|
|
||
| # Extract the value, strip HTML comments and whitespace | ||
| ASSISTED_BY_VAL=$(grep -E "^[[:space:]]*(-\s+)?Assisted-by:" <<< "$PR_BODY" | sed -r -e 's/^[[:space:]]*(-\s+)?Assisted-by://' -e 's/<!--.*-->//' | tr -d '[:space:]') | ||
| if [ -z "$ASSISTED_BY_VAL" ]; then | ||
| echo "::error::You checked the AI tool checkbox in the PR template, but did not specify the tool that was used in 'Assisted-by:'." | ||
| exit 1 | ||
| fi | ||
| fi | ||
|
|
||
| echo "PR Checklist verification passed." | ||
Uh oh!
There was an error while loading. Please reload this page.