Skip to content

Commit 304fb76

Browse files
authored
Merge pull request #5724 from plotly/add-changelog-check
[CHORE]: Add CI workflow to make sure changelog gets updated with every PR
2 parents b104c6a + 9d00782 commit 304fb76

2 files changed

Lines changed: 34 additions & 1 deletion

File tree

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Check changelog
2+
3+
on:
4+
pull_request:
5+
types: [opened, reopened, synchronize, labeled, unlabeled, ready_for_review]
6+
7+
concurrency:
8+
group: check-changelog-${{ github.event.pull_request.number }}
9+
cancel-in-progress: true
10+
11+
permissions:
12+
contents: read
13+
pull-requests: read
14+
15+
jobs:
16+
check-changelog:
17+
name: Check if CHANGELOG.md was updated
18+
if: ${{ !github.event.pull_request.draft }}
19+
runs-on: ubuntu-latest
20+
env:
21+
GH_TOKEN: ${{ github.token }}
22+
HAS_SKIP_LABEL: ${{ contains(github.event.pull_request.labels.*.name, 'no-changelog') }}
23+
steps:
24+
- run: |
25+
if [ "$HAS_SKIP_LABEL" = true ]; then
26+
echo "::notice::This PR has the 'no-changelog' label, so a change to CHANGELOG.md is not required."
27+
elif gh api "repos/${{ github.repository }}/pulls/${{ github.event.number }}/files" --paginate --jq '.[].filename' | grep -qx CHANGELOG.md; then
28+
echo "::notice::CHANGELOG.md was updated."
29+
else
30+
echo "::error::CHANGELOG.md was not updated. Either add a changelog entry, or add the 'no-changelog' label to this PR if a changelog entry is not needed."
31+
exit 1
32+
fi

CONTRIBUTING.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,8 @@ When creating your pull request, please follow the guidelines below.
181181
- If your PR modifies code of `plotly.graph_objects`, the modifications should be made to the code generator, *not* the generated files.
182182
- You have added tests or modified existing tests, as needed.
183183
- For a new feature, you have added documentation examples (please see the doc checklist as well).
184-
- You have added a CHANGELOG entry if changing anything substantial.
184+
- You have added a changelog entry to `CHANGELOG.md` if changing anything substantial.
185+
- The CI job "Check changelog" will fail if the PR does not update `CHANGELOG.md`. To bypass this check for PRs which don't require a changelog entry (e.g. docs updates), add the `no-changelog` label to the PR.
185186
- For a new feature or a change in behavior, you have updated the relevant docstrings in the code.
186187

187188
### Documentation pull request

0 commit comments

Comments
 (0)