From ff68c8cbc0c61c78b9820120bf855b34948b64d1 Mon Sep 17 00:00:00 2001 From: AbhayMishra Date: Fri, 3 Jan 2025 00:21:04 +0530 Subject: [PATCH 1/3] Updated pull_request_template --- .github/pull_request_template.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 16e7296ce..6b4d2ba5c 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -32,3 +32,9 @@ Thanks for submitting a pull request! Please provide enough information so that **Does this PR introduce a breaking change?** + +# 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). \ No newline at end of file From bd5222e37166a44e0c5e070ea55219a728b0c0ce Mon Sep 17 00:00:00 2001 From: AbhayMishra Date: Fri, 3 Jan 2025 00:43:19 +0530 Subject: [PATCH 2/3] Added the workflow --- .github/workflows/check-pr.yml | 72 ++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 .github/workflows/check-pr.yml diff --git a/.github/workflows/check-pr.yml b/.github/workflows/check-pr.yml new file mode 100644 index 000000000..1c5166079 --- /dev/null +++ b/.github/workflows/check-pr.yml @@ -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 + From c4154bedbe71acfee260185cff1c1dc3164bc066 Mon Sep 17 00:00:00 2001 From: AbhayMishra Date: Fri, 3 Jan 2025 00:44:58 +0530 Subject: [PATCH 3/3] tests --- styles/globals.css | 1 + 1 file changed, 1 insertion(+) diff --git a/styles/globals.css b/styles/globals.css index 5288d6aa4..3597b6d8b 100644 --- a/styles/globals.css +++ b/styles/globals.css @@ -81,6 +81,7 @@ border-radius: 4px; */ margin-right: 4px; margin-left: 4px; } */ + @media (max-width: 450px) { .DocSearch-Button {