Skip to content
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

Test 3 #1243

Closed
wants to merge 3 commits into from
Closed

Test 3 #1243

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
6 changes: 6 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,9 @@ Thanks for submitting a pull request! Please provide enough information so that
**Does this PR introduce a breaking change?**

<!-- If this PR introduces a breaking change, please describe the impact and a migration path for existing applications. -->

# Checklist

Please ensure the following tasks are completed before submitting this pull request.

- [ ] Read, understood, and followed the [contributing guidelines](https://github.com/json-schema-org/website/blob/main/CONTRIBUTING.md).
72 changes: 72 additions & 0 deletions .github/workflows/check-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: PR Content Checker

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

jobs:
check-pr-content:
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- name: Check PR Content
env:
PR_BODY: ${{ github.event.pull_request.body }}
PR_AUTHOR: ${{ github.event.pull_request.user.login }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
missing_items=()

# Check for required sections and their content
if ! echo "$PR_BODY" | grep -q "**What kind of change does this PR introduce?**" ||
! echo "$PR_BODY" | grep -q "**What kind of change does this PR introduce?**" -A1 | tail -n1 | grep -qv "^\s*$"; then
missing_items+=("What kind of change")
fi

if ! echo "$PR_BODY" | grep -qE "(Closes|Related to) #[0-9]+"; then
missing_items+=("Issue reference")
fi

if ! echo "$PR_BODY" | grep -q "**Summary**" ||
! echo "$PR_BODY" | grep -q "**Summary**" -A1 | tail -n1 | grep -qv "^\s*$"; then
missing_items+=("Summary")
fi

if ! echo "$PR_BODY" | grep -q "**Does this PR introduce a breaking change?**" ||
! echo "$PR_BODY" | grep -q "**Does this PR introduce a breaking change?**" -A1 | tail -n1 | grep -qv "^\s*$"; then
missing_items+=("Breaking change information")
fi

# Check for placeholder content
if echo "$PR_BODY" | grep -q "#___"; then
missing_items+=("Issue number (still contains placeholder)")
fi

# Check checklist
if ! echo "$PR_BODY" | grep -q "\[x\] Read, understood, and followed the \[contributing guidelines\]"; then
missing_items+=("Unchecked contributing guidelines checkbox")
fi

# If there are missing items, create a comment
if [ ${#missing_items[@]} -ne 0 ]; then
comment="Hi @$PR_AUTHOR. Thanks a lot for your contribution!

I noticed that some required information is missing from your PR. Could you please provide the following details:

$(printf "- %s\n" "${missing_items[@]}")

The PR has placeholders for these items. Please make sure to link the related issues to the PR and fill in all the required information. This helps reviewers better understand your changes.

Please ensure you've completed the following:
1. Linked related issues to the PR
2. Filled in all placeholder questions
3. Checked the contributing guidelines checkbox if you've read them

Thanks a lot!!"

gh pr comment ${{ github.event.pull_request.number }} --body "$comment"
exit 1
fi
shell: bash

1 change: 1 addition & 0 deletions styles/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ border-radius: 4px; */
margin-right: 4px;
margin-left: 4px;
} */


@media (max-width: 450px) {
.DocSearch-Button {
Expand Down
Loading