diff --git a/.github/workflows/check-changelog.yml b/.github/workflows/check-changelog.yml new file mode 100644 index 00000000000..b35f092b269 --- /dev/null +++ b/.github/workflows/check-changelog.yml @@ -0,0 +1,32 @@ +name: Check changelog + +on: + pull_request: + types: [opened, reopened, synchronize, labeled, unlabeled, ready_for_review] + +concurrency: + group: check-changelog-${{ github.event.pull_request.number }} + cancel-in-progress: true + +permissions: + contents: read + pull-requests: read + +jobs: + check-changelog: + name: Check if CHANGELOG.md was updated + if: ${{ !github.event.pull_request.draft }} + runs-on: ubuntu-latest + env: + GH_TOKEN: ${{ github.token }} + HAS_SKIP_LABEL: ${{ contains(github.event.pull_request.labels.*.name, 'no-changelog') }} + steps: + - run: | + if [ "$HAS_SKIP_LABEL" = true ]; then + echo "::notice::This PR has the 'no-changelog' label, so a change to CHANGELOG.md is not required." + elif gh api "repos/${{ github.repository }}/pulls/${{ github.event.number }}/files" --paginate --jq '.[].filename' | grep -qx CHANGELOG.md; then + echo "::notice::CHANGELOG.md was updated." + else + 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 + fi 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