An even fancier CHANGELOG check in CI (#8416)

This commit is contained in:
Erich Gubler 2025-11-26 17:50:22 -05:00 committed by GitHub
parent 3a157f7497
commit ee08b916e5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 17 additions and 2 deletions

View File

@ -6,6 +6,12 @@ on:
- ".github/workflows/changelog.yml"
- "CHANGELOG.md"
- "xtask/**/*"
types:
- opened
- synchronize
- reopened
- labeled
- unlabeled
env:
#
@ -38,6 +44,7 @@ jobs:
with:
fetch-depth: 0
# NOTE: Keep label name(s) in sync. with `xtask`'s implementation.
- name: Run `cargo xtask changelog …`
run: |
cargo xtask changelog "origin/${{ github.event.pull_request.base.ref }}"
cargo xtask changelog "origin/${{ github.event.pull_request.base.ref }}" ${{ contains(github.event.pull_request.labels.*.name, 'changelog: released entry changed') && '--allow-released-changes' || '' }}

View File

@ -6,6 +6,7 @@ use xshell::Shell;
pub(crate) fn check_changelog(shell: Shell, mut args: Arguments) -> anyhow::Result<()> {
const CHANGELOG_PATH_RELATIVE: &str = "./CHANGELOG.md";
let allow_released_changes = args.contains("--allow-released-changes");
let from_branch = args
.free_from_str()
@ -72,7 +73,12 @@ pub(crate) fn check_changelog(shell: Shell, mut args: Arguments) -> anyhow::Resu
"one or more checks against `{}` failed; see above for details",
CHANGELOG_PATH_RELATIVE,
);
Err(anyhow::Error::msg(msg))
if allow_released_changes {
log::warn!("{msg}");
Ok(())
} else {
Err(anyhow::Error::msg(msg))
}
} else {
Ok(())
}

View File

@ -53,6 +53,8 @@ Commands:
`<to_commit>` is the tip of the `git diff` that will be used for checking (1).
--allow-released-changes Only reports issues as warnings, rather than reporting errors and forcing a non-zero exit code.
miri
Run all miri-compatible tests under miri. Requires a nightly toolchain
with the x86_64-unknown-linux-gnu target and miri component installed.