diff --git a/.github/workflows/check-changelog.yml b/.github/workflows/check-changelog.yml new file mode 100644 index 00000000000..340f39e8531 --- /dev/null +++ b/.github/workflows/check-changelog.yml @@ -0,0 +1,18 @@ +name: Check changelog + +on: + pull_request: + types: [opened, reopened, synchronize, labeled, unlabeled] + +jobs: + check-changelog: + name: Check if CHANGELOG.md was updated + if: ${{ !contains(github.event.pull_request.labels.*.name, 'no-changelog') }} + runs-on: ubuntu-latest + steps: + - env: + GH_TOKEN: ${{ github.token }} + run: | + gh api "repos/${{ github.repository }}/pulls/${{ github.event.number }}/files" --paginate --jq '.[].filename' \ + | grep -qx CHANGELOG.md \ + || { 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."; exit 1; } diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e1e5f211bc9..2a32b8d34c9 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -181,7 +181,8 @@ When creating your pull request, please follow the guidelines below. - If your PR modifies code of `plotly.graph_objects`, the modifications should be made to the code generator, *not* the generated files. - You have added tests or modified existing tests, as needed. - For a new feature, you have added documentation examples (please see the doc checklist as well). -- You have added a CHANGELOG entry if changing anything substantial. +- You have added a changelog entry to `CHANGELOG.md` if changing anything substantial. + - 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. - For a new feature or a change in behavior, you have updated the relevant docstrings in the code. ### Documentation pull request