-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathgithub.jq
More file actions
37 lines (35 loc) · 923 Bytes
/
github.jq
File metadata and controls
37 lines (35 loc) · 923 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import "bash" as bash;
import "str" as str;
def log_bubble(matching; excluding):
str::matches(matching; excluding)
| . as $bubble
| $bubble.notice // []
| unique
| if length > 10 then
.[:9] + ["... and \(.|length - 9) more notices"]
else . end
| map("echo ::notice::\(.)") as $notices
| $bubble.error // []
| unique
| if length > 10 then
.[:9] + ["... and \(.|length - 9) more errors"]
else . end
| map("echo ::error::\(.)") as $errors
| $bubble.warning // []
| unique
| if length > 10 then
.[:9] + ["... and \(.|length - 9) more warnings"]
else . end
| map("echo ::warning::\(.)") as $warnings
| $bubble.fail // []
| if length > 0 then
join("\n ")
| ["echo ::error::Failure: \n \(.)", "exit 1"]
else . end
| . as $exit
| ($notices + $errors + $warnings + $exit)
| bash::xfor
;
def log_bubble(matching):
log_bubble(matching; null)
;