-
Notifications
You must be signed in to change notification settings - Fork 27
Expand file tree
/
Copy pathgithub.sh
More file actions
61 lines (46 loc) · 1.34 KB
/
github.sh
File metadata and controls
61 lines (46 loc) · 1.34 KB
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/usr/bin/env bash
github::get_event_name() {
echo "$GITHUB_EVENT_NAME"
}
github::get_action() {
jq --raw-output .action "$GITHUB_EVENT_PATH"
}
github::get_pr_number() {
jq --raw-output .pull_request.number "$GITHUB_EVENT_PATH"
}
github::get_pr_body() {
jq --raw-output .pull_request.body "$GITHUB_EVENT_PATH" | sed -r 's/^#{1,3}\ /#### /g'
}
github::get_head_ref() {
jq --raw-output .pull_request.head.ref "$GITHUB_EVENT_PATH"
}
github::get_base_ref() {
jq --raw-output .pull_request.base.ref "$GITHUB_EVENT_PATH"
}
github::get_repository_full_name() {
jq --raw-output .pull_request.head.repo.full_name "$GITHUB_EVENT_PATH"
}
github::get_pr_url() {
jq --raw-output .pull_request.html_url "$GITHUB_EVENT_PATH"
}
github::get_pr_title() {
jq --raw-output .pull_request.title "$GITHUB_EVENT_PATH"
}
github::get_pr_patch_stats() {
jq --raw-output '.pull_request | "\(.commits) \(.changed_files) \(.additions) \(.deletions)"' "$GITHUB_EVENT_PATH"
}
github::get_pr_merged() {
jq --raw-output .pull_request.merged "$GITHUB_EVENT_PATH"
}
github::get_sender_user() {
jq --raw-output .sender.login "$GITHUB_EVENT_PATH"
}
github::get_review_state() {
jq --raw-output .review.state "$GITHUB_EVENT_PATH"
}
github::get_review_comment() {
jq --raw-output .review.body "$GITHUB_EVENT_PATH"
}
github::print_all_data() {
cat "$GITHUB_EVENT_PATH"
}