Skip to content

Commit 4a2cfab

Browse files
test(CHANGELOG): add --warn-only to cargo xtask changelog
1 parent d2d9851 commit 4a2cfab

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

xtask/src/changelog.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ use xshell::Shell;
33

44
pub(crate) fn check_changelog(shell: Shell, mut args: Arguments) -> anyhow::Result<()> {
55
const CHANGELOG_PATH_RELATIVE: &str = "./CHANGELOG.md";
6+
let warn_only = args.contains("--warn-only");
67

78
let from_branch = args
89
.free_from_str()
@@ -69,7 +70,12 @@ pub(crate) fn check_changelog(shell: Shell, mut args: Arguments) -> anyhow::Resu
6970
"one or more checks against `{}` failed; see above for details",
7071
CHANGELOG_PATH_RELATIVE,
7172
);
72-
Err(anyhow::Error::msg(msg))
73+
if warn_only {
74+
log::warn!("{msg}");
75+
Ok(())
76+
} else {
77+
Err(anyhow::Error::msg(msg))
78+
}
7379
} else {
7480
Ok(())
7581
}

xtask/src/main.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ Commands:
5252
5353
`<to_commit>` is the tip of the `git diff` that will be used for checking (1).
5454
55+
--warn-only Only reports issues as warnings, rather than reporting errors and forcing a non-zero exit code.
56+
5557
miri
5658
Run all miri-compatible tests under miri. Requires a nightly toolchain
5759
with the x86_64-unknown-linux-gnu target and miri component installed.

0 commit comments

Comments
 (0)