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() {
2828 jq --raw-output .pull_request.title " $GITHUB_EVENT_PATH "
2929}
3030
31+ github::get_pr_merged () {
32+ jq --raw-output .pull_request.merged " $GITHUB_EVENT_PATH "
33+ }
34+
3135github::get_sender_user () {
3236 jq --raw-output .sender.login " $GITHUB_EVENT_PATH "
3337}
Original file line number Diff line number Diff line change @@ -47,11 +47,19 @@ teamwork::pull_request_closed() {
4747 local -r user=$( github::get_sender_user)
4848 local -r pr_url=$( github::get_pr_url)
4949 local -r pr_title=$( github::get_pr_title)
50+ local -r pr_merged=$( github::get_pr_merged)
5051
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
5563}
5664
5765teamwork::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 11{
22 "action" : " closed" ,
33 "number" : 1 ,
4- "merged" : true ,
54 "pull_request" : {
65 "body" : " This is the body of the PR. https://xxxx.teamwork.com/#/tasks/123 https://xxx.teamwork.com/#/tasks/456" ,
76 "head" : {
109 }
1110 },
1211 "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
1414 },
1515 "sender" : {
1616 "login" : " username"
You can’t perform that action at this time.
0 commit comments