diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 90b85998..b344525c 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -4,6 +4,7 @@ By submitting these contributions you agree for them to be dual-licensed under P Please consider adding the following to your pull request: - an entry for this PR in newsfragments - see [https://pyo3.rs/main/contributing.html#documenting-changes] + - or start the PR title with `docs:` if this is a docs-only change to skip the check - docs to all new functions and / or detail in the guide - tests for all new or changed functions diff --git a/.github/workflows/changelog.yml b/.github/workflows/changelog.yml index 220c8095..cc0f54fb 100644 --- a/.github/workflows/changelog.yml +++ b/.github/workflows/changelog.yml @@ -2,7 +2,7 @@ name: changelog on: pull_request: - types: [opened, synchronize, labeled, unlabeled] + types: [opened, synchronize, labeled, unlabeled, edited] jobs: check: diff --git a/Contributing.md b/Contributing.md index 319a6397..3af6a160 100644 --- a/Contributing.md +++ b/Contributing.md @@ -111,6 +111,8 @@ To include your changes in the release notes, you should create one (or more) ne - `removed` - for features which have been removed - `fixed` - for "changed" features which were classed as a bugfix +Docs-only PRs do not need news items; start your PR title with `docs:` to skip the check. + ### Style guide #### Generic code diff --git a/noxfile.py b/noxfile.py index 388d57f4..525cf898 100644 --- a/noxfile.py +++ b/noxfile.py @@ -416,6 +416,12 @@ def address_sanitizer(session: nox.Session): ) +_IGNORE_CHANGELOG_PR_CATEGORIES = ( + "release", + "docs", +) + + @nox.session(name="check-changelog") def check_changelog(session: nox.Session): event_path = os.environ.get("GITHUB_EVENT_PATH") @@ -425,8 +431,9 @@ def check_changelog(session: nox.Session): with open(event_path) as event_file: event = json.load(event_file) - if event["pull_request"]["title"].startswith("release:"): - session.skip("PR title starts with release") + for category in _IGNORE_CHANGELOG_PR_CATEGORIES: + if event["pull_request"]["title"].startswith(f"{category}:"): + session.skip(f"PR title starts with {category}") for label in event["pull_request"]["labels"]: if label["name"] == "CI-skip-changelog": @@ -448,7 +455,9 @@ def check_changelog(session: nox.Session): if not fragments: session.error( - "Changelog entry not found, please add one (or more) to `newsfragments` directory. For more information see https://github.com/PyO3/pyo3/blob/main/Contributing.md#documenting-changes" + "Changelog entry not found, please add one (or more) to the `newsfragments` directory.\n" + "Alternatively, start the PR title with `docs:` if this PR is a docs-only PR.\n" + "See https://github.com/PyO3/pyo3/blob/main/Contributing.md#documenting-changes for more information." ) print("Found newsfragments:")