File tree Expand file tree Collapse file tree 4 files changed +36
-6
lines changed Expand file tree Collapse file tree 4 files changed +36
-6
lines changed Original file line number Diff line number Diff line change @@ -28,6 +28,10 @@ github::get_pr_title() {
28
28
jq --raw-output .pull_request.title " $GITHUB_EVENT_PATH "
29
29
}
30
30
31
+ github::get_pr_merged () {
32
+ jq --raw-output .pull_request.merged " $GITHUB_EVENT_PATH "
33
+ }
34
+
31
35
github::get_sender_user () {
32
36
jq --raw-output .sender.login " $GITHUB_EVENT_PATH "
33
37
}
Original file line number Diff line number Diff line change @@ -47,11 +47,19 @@ teamwork::pull_request_closed() {
47
47
local -r user=$( github::get_sender_user)
48
48
local -r pr_url=$( github::get_pr_url)
49
49
local -r pr_title=$( github::get_pr_title)
50
+ local -r pr_merged=$( github::get_pr_merged)
50
51
51
- teamwork::add_comment "
52
- **$user ** merged a PR: **$pr_title **
53
- [$pr_url ]($pr_url )
54
- "
52
+ if [ " $pr_merged " == " true" ]; then
53
+ teamwork::add_comment "
54
+ **$user ** merged a PR: **$pr_title **
55
+ [$pr_url ]($pr_url )
56
+ "
57
+ else
58
+ teamwork::add_comment "
59
+ **$user ** closed a PR without merging: **$pr_title **
60
+ [$pr_url ]($pr_url )
61
+ "
62
+ fi
55
63
}
56
64
57
65
teamwork::pull_request_review_submitted () {
Original file line number Diff line number Diff line change
1
+ {
2
+ "action" : " closed" ,
3
+ "number" : 1 ,
4
+ "pull_request" : {
5
+ "body" : " This is the body of the PR. https://xxxx.teamwork.com/#/tasks/123 https://xxx.teamwork.com/#/tasks/456" ,
6
+ "head" : {
7
+ "repo" : {
8
+ "full_name" : " teamwork/github-sync"
9
+ }
10
+ },
11
+ "html_url" : " https://github.com/teamwork/github-sync/pull/1" ,
12
+ "title" : " This is an example of a title for the PR." ,
13
+ "merged" : false
14
+ },
15
+ "sender" : {
16
+ "login" : " username"
17
+ }
18
+ }
Original file line number Diff line number Diff line change 1
1
{
2
2
"action" : " closed" ,
3
3
"number" : 1 ,
4
- "merged" : true ,
5
4
"pull_request" : {
6
5
"body" : " This is the body of the PR. https://xxxx.teamwork.com/#/tasks/123 https://xxx.teamwork.com/#/tasks/456" ,
7
6
"head" : {
10
9
}
11
10
},
12
11
"html_url" : " https://github.com/teamwork/github-sync/pull/1" ,
13
- "title" : " This is an example of a title for the PR."
12
+ "title" : " This is an example of a title for the PR." ,
13
+ "merged" : true
14
14
},
15
15
"sender" : {
16
16
"login" : " username"
You can’t perform that action at this time.
0 commit comments