Skip to content

Commit 949518d

Browse files
WIP: test(CHANGELOG): add changelog: released entry changed label escape hatch
TODO: check for label in action, plumb option to still succeed? TODO: test it out TODO: docs
1 parent 8c4cc44 commit 949518d

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

.github/workflows/changelog.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ on:
99
- opened
1010
- synchronize
1111
- reopened
12+
- labeled
13+
- unlabeled
1214

1315
env:
1416
#
@@ -44,5 +46,6 @@ jobs:
4446
- name: Run `cargo xtask changelog …`
4547
run: >
4648
cargo xtask changelog --emit-github-messages
49+
${{ contains(github.event.issue.labels.*.name, 'changelog: released entry changed') && '--warn-only' || '' }}
4750
"origin/${{ github.event.pull_request.base.ref }}"
4851
>> "$GITHUB_STEP_SUMMARY"

xtask/src/changelog.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ pub(crate) fn check_changelog(shell: Shell, mut args: Arguments) -> anyhow::Resu
55
const CHANGELOG_PATH_RELATIVE: &str = "./CHANGELOG.md";
66

77
let emit_github_messages = args.contains("--emit-github-messages");
8+
let warn_only = args.contains("--warn-only");
89

910
let from_branch = args
1011
.free_from_str()
@@ -65,10 +66,11 @@ pub(crate) fn check_changelog(shell: Shell, mut args: Arguments) -> anyhow::Resu
6566
eprintln!("{}", hunk.contents);
6667

6768
if emit_github_messages {
69+
let severity = if warn_only { "warning" } else { "error" };
6870
let title = "";
6971
let message = "";
7072
println!(
71-
"::error file={},line={},endLine={},title={title}::{message}",
73+
"::{severity} file={},line={},endLine={},title={title}::{message}",
7274
CHANGELOG_PATH_RELATIVE, hunk.change_start_line_num, hunk.change_end_line_num,
7375
)
7476
}
@@ -81,7 +83,12 @@ pub(crate) fn check_changelog(shell: Shell, mut args: Arguments) -> anyhow::Resu
8183
"one or more checks against `{}` failed; see above for details",
8284
CHANGELOG_PATH_RELATIVE,
8385
);
84-
Err(anyhow::Error::msg(msg))
86+
if warn_only {
87+
log::warn!("{msg}");
88+
Ok(())
89+
} else {
90+
Err(anyhow::Error::msg(msg))
91+
}
8592
} else {
8693
Ok(())
8794
}

0 commit comments

Comments
 (0)