Skip to content

Commit

Permalink
Added new function to remove the task header from the PR body so we d…
Browse files Browse the repository at this point in the history
…on't add it to a comment in TW
  • Loading branch information
BrandonOldenhof committed May 10, 2023
1 parent 6a8be36 commit dc458a8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
8 changes: 7 additions & 1 deletion src/github.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ github::get_pr_title() {
}

github::get_pr_patch_stats() {
jq --raw-output '.pull_request | "\(.commits) \(.changed_files) \(.additions) \(.deletions)"' "$GITHUB_EVENT_PATH"
jq --raw-output '.pull_request | "\(.commits) \(.changed_files) \(.additions) \(.deletions)"' "$GITHUB_EVENT_PATH"
}

github::get_pr_merged() {
Expand All @@ -59,3 +59,9 @@ github::get_review_comment() {
github::print_all_data() {
cat "$GITHUB_EVENT_PATH"
}

github::get_pr_body_without_task() {
local -r pr_body=$(github::get_pr_body)
local output=$(echo "$pr_body" | sed -E 's/#### Description of the changes(.*)/\n#### Description of the changes\1/g')
log::message "$output"
}
11 changes: 6 additions & 5 deletions src/teamwork.sh
Original file line number Diff line number Diff line change
Expand Up @@ -163,17 +163,18 @@ teamwork::pull_request_closed() {
local -r pr_url=$(github::get_pr_url)
local -r pr_title=$(github::get_pr_title)
local -r pr_merged=$(github::get_pr_merged)
local -r pr_body=$(github::get_pr_body)
local -r pr_body=$(github::get_pr_body_without_task)

if [ "$pr_merged" == "true" ]; then
teamwork::add_comment "
**$user** merged the [$pr_title]($pr_url) PR for this task.
**$user** merged the [$pr_url]($pr_url) PR for this task:
---
---
${pr_body}
${pr_body}
" true
---
"
teamwork::move_task_to_column "$BOARD_COLUMN_MERGED"
teamwork::update_estimation 0
else
Expand Down

0 comments on commit dc458a8

Please sign in to comment.