Skip to content

Commit 1bd4074

Browse files
committed
Add --as-table flag to check-prs
1 parent f01bc44 commit 1bd4074

File tree

2 files changed

+17
-11
lines changed

2 files changed

+17
-11
lines changed

make_release/notes/notice.nu

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,31 @@
1+
const TYPES = [
2+
[type, color, rank];
3+
[info, (ansi default), 0]
4+
[warning, (ansi yellow), 1]
5+
[error, (ansi red), 2]
6+
]
7+
18
# Add an entry to the "notices" field of a PR
29
export def add-notice [type: string, message: string]: record -> record {
310
upsert notices {
411
append {type: $type, message: $message}
512
}
613
}
714

8-
# Print all of the notices associated with a PR
9-
export def display-notices []: table -> nothing {
15+
export def group-notices []: table -> table {
1016
let prs = $in
11-
let types = [
12-
[type, color, rank];
13-
[info, (ansi default), 0]
14-
[warning, (ansi yellow), 1]
15-
[error, (ansi red), 2]
16-
]
1717

1818
$prs
1919
| flatten -a notices
2020
| group-by --to-table type? message?
21-
| sort-by {|i| $types | where type == $i.type | only rank } message
21+
| sort-by {|i| $TYPES | where type == $i.type | only rank } message
22+
}
23+
24+
# Print all of the notices associated with a PR
25+
export def display-notices []: table -> nothing {
26+
group-notices
2227
| each {|e|
23-
let color = $types | where type == $e.type | only color
28+
let color = $TYPES | where type == $e.type | only color
2429
let number = $e.items | length
2530
print $"($color)($number) PR\(s\) with ($e.message):"
2631
$e.items | each { format-pr | print $"- ($in)" }

make_release/notes/tools.nu

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,13 @@ export def release-notes [
6868
# Check the release note summaries for the specified version.
6969
export def check-prs [
7070
version: string@"nu-complete version" # the version to generate release notes for
71+
--as-table (-t) # output PR checks as a table
7172
]: nothing -> nothing {
7273
query-prs --milestone=$version
7374
| where not author.is_bot
7475
| sort-by mergedAt
7576
| each { get-release-notes }
76-
| display-notices
77+
| if $as_table { group-notices } else { display-notices }
7778
}
7879

7980
# Format the output of `list-prs` as a markdown table

0 commit comments

Comments
 (0)