Skip to content

Commit 1a60a98

Browse files
kopporpalukkusubhramit
authored
workflow added for detecting changelog modification (#12783) (#12807)
Co-authored-by: Philip <[email protected]> Co-authored-by: Subhramit Basu <[email protected]>
1 parent 5c927fa commit 1a60a98

File tree

2 files changed

+43
-0
lines changed

2 files changed

+43
-0
lines changed

.github/ghprcomment.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,3 +115,11 @@
115115
116116
You can then run these tests in IntelliJ to reproduce the failing tests locally.
117117
We offer a quick test running howto in the section [Final build system checks](https://devdocs.jabref.org/getting-into-the-code/guidelines-for-setting-up-a-local-workspace/intellij-12-build.html#final-build-system-checks) in our setup guide.
118+
- jobName: 'CHANGELOG.md needs to be modified'
119+
message: >
120+
You ticked that you modified `CHANGELOG.md`, but no new entry was found there.
121+
122+
123+
If you made changes that are visible to the user, please add a brief description along with the issue number to the `CHANGELOG.md` file.
124+
If you did not, please replace the cross (`[x]`) by a slash (`[/]`) to indicate that no `CHANGELOG.md` entry is necessary.
125+
More details can be found in our [Developer Documentation about the changelog](https://devdocs.jabref.org/decisions/0007-human-readable-changelog.html).

.github/workflows/tests.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -481,3 +481,38 @@ jobs:
481481
with:
482482
name: pr_number
483483
path: pr_number.txt
484+
485+
changelog_modified:
486+
name: CHANGELOG.md needs to be modified
487+
if: github.actor != 'dependabot[bot]' && github.event_name == 'pull_request'
488+
runs-on: ubuntu-latest
489+
steps:
490+
- uses: actions/checkout@v4
491+
with:
492+
fetch-depth: 0
493+
- name: Check PR body for changelog note
494+
id: changelog_check
495+
run: |
496+
BODY=$(gh pr view "${{ github.event.number }}" --json body --template '{{.body}}')
497+
echo "Body: $BODY"
498+
499+
if echo "$BODY" | grep -q '\- \[x\] Change in `CHANGELOG.md`'; then
500+
echo "found"
501+
echo "found=yes" >> $GITHUB_OUTPUT
502+
else
503+
echo "not found"
504+
echo "found=no" >> $GITHUB_OUTPUT
505+
fi
506+
env:
507+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
508+
- name: Check for CHANGELOG.md modifications
509+
id: check_changelog_modification
510+
if: steps.changelog_check.outputs.found == 'yes'
511+
run: |
512+
git fetch origin ${{ github.base_ref }}
513+
if git diff --name-only origin/${{ github.base_ref }}...HEAD | grep -q '^CHANGELOG\.md$'; then
514+
echo "✅ CHANGELOG.md was modified"
515+
else
516+
echo "❌ CHANGELOG.md was NOT modified"
517+
exit 1
518+
fi

0 commit comments

Comments
 (0)