File tree Expand file tree Collapse file tree 2 files changed +17
-11
lines changed
Expand file tree Collapse file tree 2 files changed +17
-11
lines changed Original file line number Diff line number Diff line change 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
29export 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 )" }
Original file line number Diff line number Diff line change @@ -68,12 +68,13 @@ export def release-notes [
6868# Check the release note summaries for the specified version.
6969export 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
You can’t perform that action at this time.
0 commit comments