Skip to content

Commit 8e2aed7

Browse files
kopporsubhramit
authored andcommitted
Use dots in checklist - and add check (JabRef#12788)
Co-authored-by: Subhramit Basu <[email protected]>
1 parent 34266e3 commit 8e2aed7

File tree

3 files changed

+62
-8
lines changed

3 files changed

+62
-8
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,18 @@ If your work is not yet complete, please open a draft pull request. In that case
1010
### Mandatory checks
1111

1212
<!--
13-
Go throgh the checklist below. It is mandatory, even for a draft pull request.
13+
Go through the checklist below. It is mandatory, even for a draft pull request.
1414
15-
Keep ALL the items. Mark them as follows:
15+
Keep ALL the items. Replace the dots inside [.] and mark them as follows:
1616
[x] done
1717
[ ] not done
1818
[/] not applicable
1919
-->
2020

2121
- [x] I own the copyright of the code submitted and I license it under the [MIT license](https://github.com/JabRef/jabref/blob/main/LICENSE)
22-
- [ ] Change in `CHANGELOG.md` described in a way that is understandable for the average user (if change is visible to the user)
23-
- [ ] Tests created for changes (if applicable)
24-
- [ ] Manually tested changed features in running JabRef (always required)
25-
- [ ] Screenshots added in PR description (if change is visible to the user)
26-
- [ ] [Checked developer's documentation](https://devdocs.jabref.org/): Is the information available and up to date? If not, I outlined it in this pull request.
27-
- [ ] [Checked documentation](https://docs.jabref.org/): Is the information available and up to date? If not, I created an issue at <https://github.com/JabRef/user-documentation/issues> or, even better, I submitted a pull request to the documentation repository.
22+
- [.] Change in `CHANGELOG.md` described in a way that is understandable for the average user (if change is visible to the user)
23+
- [.] Tests created for changes (if applicable)
24+
- [.] Manually tested changed features in running JabRef (always required)
25+
- [.] Screenshots added in PR description (if change is visible to the user)
26+
- [.] [Checked developer's documentation](https://devdocs.jabref.org/): Is the information available and up to date? If not, I outlined it in this pull request.
27+
- [.] [Checked documentation](https://docs.jabref.org/): Is the information available and up to date? If not, I created an issue at <https://github.com/JabRef/user-documentation/issues> or, even better, I submitted a pull request to the documentation repository.

.github/ghprcomment.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
- jobName: 'PR checklist OK'
2+
messsage:
3+
Note that your PR will not be accepted/reviewed until you have gone through the mandatory checks in the description, or have removed them.
14
- jobName: 'Source branch is other than "main"'
25
message: >
36
You committed your code on `main` brach. This is bad practise.

.github/workflows/tests.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,57 @@ jobs:
356356
show-progress: 'false'
357357
- uses: gradle/actions/wrapper-validation@v4
358358

359+
checklist-checked:
360+
if: github.actor != 'dependabot[bot]' && github.event_name == 'pull_request'
361+
name: PR checklist OK
362+
runs-on: ubuntu-latest
363+
steps:
364+
- name: Checkout source
365+
uses: actions/checkout@v4
366+
with:
367+
submodules: 'false'
368+
show-progress: 'false'
369+
- name: Check for PR checklist
370+
id: check_changelog_modification
371+
run: |
372+
set -e
373+
374+
BODY=$(gh pr view "${{ github.event.number }}" --json body --template '{{.body}}' | grep -A5000 '### Mandatory checks')
375+
echo "Found body: $BODY"
376+
377+
# Ensure the section exists
378+
if ! printf '%s\n' "$BODY" | grep -q "### Mandatory checks"; then
379+
echo "❌ '### Mandatory checks' section is missing!"
380+
exit 1
381+
fi
382+
383+
BOXES=$(printf '%s\n' "$BODY" | grep "^- \[")
384+
echo "Found boxes: $BOXES"
385+
386+
# Ensure at least one checkbox exists
387+
if [ -z "$BOXES" ]; then
388+
echo "❌ No checkboxes found in '### Mandatory checks'!"
389+
exit 1
390+
fi
391+
392+
while IFS= read -r line; do
393+
if ! printf '%s\n' "$line" | grep -Eq "^- \[(x|/| )\] "; then
394+
echo "❌ Found improperly formatted checkbox: '$line'"
395+
exit 1
396+
fi
397+
done <<< "$BOXES"
398+
399+
LINE_COUNT=$(echo "$BOXES" | wc -l)
400+
401+
if [ "$LINE_COUNT" -ne 7 ]; then
402+
echo "❌ $LINE_COUNT instead of 7 lines"
403+
exit 1
404+
fi
405+
406+
echo "✅ All checkboxes are in the correct format."
407+
env:
408+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
409+
359410
# This ensures that no git merge conflict markers (<<<, ...) are contained
360411
merge_conflict_job:
361412
name: Find merge conflicts

0 commit comments

Comments
 (0)