WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
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() {
2828 jq --raw-output .pull_request.title " $GITHUB_EVENT_PATH "
2929}
3030
31+ github::get_pr_patch_stats () {
32+ jq --raw-output ' .pull_request | "\(.commits) \(.changed_files) \(.additions) \(.deletions)"' " $GITHUB_EVENT_PATH "
33+ }
34+
3135github::get_pr_merged () {
3236 jq --raw-output .pull_request.merged " $GITHUB_EVENT_PATH "
3337}
Original file line number Diff line number Diff line change @@ -36,10 +36,16 @@ teamwork::pull_request_opened() {
3636 local -r pr_url=$( github::get_pr_url)
3737 local -r pr_title=$( github::get_pr_title)
3838 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"
3941
4042 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
4349 "
4450}
4551
@@ -74,7 +80,9 @@ teamwork::pull_request_review_submitted() {
7480 teamwork::add_comment "
7581**$user ** submitted a review to the PR: **$pr_title **
7682[$pr_url ]($pr_url )
83+
7784---
85+
7886Review: **$review_state **
7987$comment
8088"
Original file line number Diff line number Diff line change 99 }
1010 },
1111 "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
1317 },
1418 "sender" : {
1519 "login" : " username"
You can’t perform that action at this time.
0 commit comments