From dc458a808a224e47af788f0ef372eb0b153e226d Mon Sep 17 00:00:00 2001 From: Brandon Oldenhof Date: Wed, 10 May 2023 12:18:55 +0200 Subject: [PATCH] Added new function to remove the task header from the PR body so we don't add it to a comment in TW --- src/github.sh | 8 +++++++- src/teamwork.sh | 11 ++++++----- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/github.sh b/src/github.sh index 726b906b..31f3549f 100644 --- a/src/github.sh +++ b/src/github.sh @@ -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() { @@ -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" +} diff --git a/src/teamwork.sh b/src/teamwork.sh index e487c09a..fecdd34b 100644 --- a/src/teamwork.sh +++ b/src/teamwork.sh @@ -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