File tree Expand file tree Collapse file tree 3 files changed +19
-3
lines changed Expand file tree Collapse file tree 3 files changed +19
-3
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_patch_stats () {
32
+ jq --raw-output ' .pull_request | "\(.commits) \(.changed_files) \(.additions) \(.deletions)"' " $GITHUB_EVENT_PATH "
33
+ }
34
+
31
35
github::get_pr_merged () {
32
36
jq --raw-output .pull_request.merged " $GITHUB_EVENT_PATH "
33
37
}
Original file line number Diff line number Diff line change @@ -36,10 +36,16 @@ teamwork::pull_request_opened() {
36
36
local -r pr_url=$( github::get_pr_url)
37
37
local -r pr_title=$( github::get_pr_title)
38
38
local -r user=$( github::get_sender_user)
39
+ local -r pr_stats=$( github::get_pr_patch_stats)
40
+ IFS=" " read -r -a pr_stats_array <<< " $pr_stats"
39
41
40
42
teamwork::add_comment "
41
- **$user ** opened a PR: **$pr_title **
42
- [$pr_url ]($pr_url )
43
+ **$user ** opened a PR: **$pr_title **
44
+ [$pr_url ]($pr_url )
45
+
46
+ ---
47
+
48
+ 🔢 ${pr_stats_array[0]} commits / 📝 ${pr_stats_array[1]} files updated / ${pr_stats_array[2]} additions / ${pr_stats_array[3]} deletions
43
49
"
44
50
}
45
51
@@ -74,7 +80,9 @@ teamwork::pull_request_review_submitted() {
74
80
teamwork::add_comment "
75
81
**$user ** submitted a review to the PR: **$pr_title **
76
82
[$pr_url ]($pr_url )
83
+
77
84
---
85
+
78
86
Review: **$review_state **
79
87
$comment
80
88
"
Original file line number Diff line number Diff line change 9
9
}
10
10
},
11
11
"html_url" : " https://github.com/teamwork/github-sync/pull/1" ,
12
- "title" : " This is an example of a title for the PR."
12
+ "title" : " This is an example of a title for the PR." ,
13
+ "commits" : 1 ,
14
+ "additions" : 2 ,
15
+ "deletions" : 3 ,
16
+ "changed_files" : 4
13
17
},
14
18
"sender" : {
15
19
"login" : " username"
You can’t perform that action at this time.
0 commit comments