Skip to content

Commit 9c367a1

Browse files
committed
Add head & base ref, limit markdown headings
1 parent 1961abf commit 9c367a1

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

src/github.sh

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,15 @@ github::get_pr_number() {
1313
}
1414

1515
github::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}/####/'
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

1927
github::get_repository_full_name() {

src/teamwork.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ teamwork::remove_tag() {
7171
teamwork::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"

0 commit comments

Comments
 (0)