File tree Expand file tree Collapse file tree 3 files changed +20
-4
lines changed
Expand file tree Collapse file tree 3 files changed +20
-4
lines changed Original file line number Diff line number Diff line change @@ -13,7 +13,15 @@ github::get_pr_number() {
1313}
1414
1515github::get_pr_body () {
16- jq --raw-output .pull_request.body " $GITHUB_EVENT_PATH "
16+ jq --raw-output .pull_request.body " $GITHUB_EVENT_PATH " | sed -r ' s/^#{1,3}\ /#### /g'
17+ }
18+
19+ github::get_head_ref () {
20+ jq --raw-output .pull_request.head.ref " $GITHUB_EVENT_PATH "
21+ }
22+
23+ github::get_base_ref () {
24+ jq --raw-output .pull_request.base.ref " $GITHUB_EVENT_PATH "
1725}
1826
1927github::get_repository_full_name () {
Original file line number Diff line number Diff line change @@ -71,6 +71,8 @@ teamwork::remove_tag() {
7171teamwork::pull_request_opened () {
7272 local -r pr_url=$( github::get_pr_url)
7373 local -r pr_title=$( github::get_pr_title)
74+ local -r head_ref=$( github::get_head_ref)
75+ local -r base_ref=$( github::get_base_ref)
7476 local -r user=$( github::get_sender_user)
7577 local -r pr_stats=$( github::get_pr_patch_stats)
7678 local -r pr_body=$( github::get_pr_body)
@@ -79,14 +81,16 @@ teamwork::pull_request_opened() {
7981 teamwork::add_comment "
8082**$user ** opened a PR: **$pr_title **
8183[$pr_url ]($pr_url )
84+ \` $base_ref \` <- \` $head_ref \`
8285
8386---
8487
85- ${pr_body//###/#### }
88+ ${pr_body}
8689
8790---
8891
8992🔢 ${pr_stats_array[0]} commits / 📝 ${pr_stats_array[1]} files updated / ➕ ${pr_stats_array[2]} additions / ➖ ${pr_stats_array[3]} deletions
93+
9094 "
9195
9296 teamwork::add_tag " PR Open"
Original file line number Diff line number Diff line change 22 "action" : " opened" ,
33 "number" : 1 ,
44 "pull_request" : {
5- "body" : " This is the body of the PR. https://xxxx.teamwork.com/#/tasks/123 https://xxx.teamwork.com/#/tasks/456" ,
5+ "body" : " # Test heading \n This is the body of the PR. https://xxxx.teamwork.com/#/tasks/123 https://xxx.teamwork.com/#/tasks/456" ,
66 "head" : {
7+ "ref" : " pr-branch" ,
78 "repo" : {
89 "full_name" : " teamwork/github-sync"
910 }
1011 },
12+ "base" : {
13+ "ref" : " main"
14+ },
1115 "html_url" : " https://github.com/teamwork/github-sync/pull/1" ,
1216 "title" : " This is an example of a title for the PR." ,
1317 "commits" : 1 ,
1822 "sender" : {
1923 "login" : " username"
2024 }
21- }
25+ }
You can’t perform that action at this time.
0 commit comments