Skip to content

Commit 617ee1e

Browse files
committed
Include PR title in lightweight comments
When LIGHTWEIGHT_COMMENT is enabled, the Teamwork comments dropped the PR title entirely. Add the title as a bold, linked label after the PR link so brief comments still surface which PR they refer to while staying to a single line, e.g. [PR](url) [**"Fix login"**](url) opened by user
1 parent 4c9fc4e commit 617ee1e

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ jobs:
5757
```
5858

5959
## Usage
60-
When creating a new PR, write in the description of the PR the URL of the task. The action will automatically add a comment in the task. Optionally, you may choose for a lightweight comment that will only include the PR URL and the user that performed the action, to enable this option set the `LIGHTWEIGHT_COMMENT` input to `true`.
60+
When creating a new PR, write in the description of the PR the URL of the task. The action will automatically add a comment in the task. Optionally, you may choose for a lightweight comment that will only include the PR title, URL and the user that performed the action, to enable this option set the `LIGHTWEIGHT_COMMENT` input to `true`.
6161

6262
Please note, the comment will be created in Teamwork under the account you have attached to this action. If the API key of the user you are using does not have permissions to access certain projects, the comment will not be created.
6363

src/teamwork.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ teamwork::pull_request_opened() {
146146
IFS=" " read -r -a pr_stats_array <<< "$pr_stats"
147147

148148
if [ "$LIGHTWEIGHT_COMMENT" == "true" ]; then
149-
teamwork::add_comment "[PR]($pr_url) opened by $user"
149+
teamwork::add_comment "[PR]($pr_url) [**\"$pr_title\"**]($pr_url) opened by $user"
150150
else
151151
teamwork::add_comment "
152152
**$user** opened a PR: **$pr_title**
@@ -176,7 +176,7 @@ teamwork::pull_request_closed() {
176176

177177
if [ "$pr_merged" == "true" ]; then
178178
if [ "$LIGHTWEIGHT_COMMENT" == "true" ]; then
179-
teamwork::add_comment "[PR]($pr_url) merged by $user"
179+
teamwork::add_comment "[PR]($pr_url) [**\"$pr_title\"**]($pr_url) merged by $user"
180180
else
181181
teamwork::add_comment "
182182
**$user** merged a PR: **$pr_title**
@@ -189,7 +189,7 @@ teamwork::pull_request_closed() {
189189
teamwork::move_task_to_column "$BOARD_COLUMN_MERGED"
190190
else
191191
if [ "$LIGHTWEIGHT_COMMENT" == "true" ]; then
192-
teamwork::add_comment "[PR]($pr_url) closed without merging by $user"
192+
teamwork::add_comment "[PR]($pr_url) [**\"$pr_title\"**]($pr_url) closed without merging by $user"
193193
else
194194
teamwork::add_comment "
195195
**$user** closed a PR without merging: **$pr_title**
@@ -212,7 +212,7 @@ teamwork::pull_request_review_submitted() {
212212
# Only add a message if the PR has been approved
213213
if [ "$review_state" == "approved" ]; then
214214
if [ "$LIGHTWEIGHT_COMMENT" == "true" ]; then
215-
teamwork::add_comment "[PR]($pr_url) approved by $user"
215+
teamwork::add_comment "[PR]($pr_url) [**\"$pr_title\"**]($pr_url) approved by $user"
216216
else
217217
teamwork::add_comment "
218218
**$user** submitted a review to the PR: **$pr_title**

0 commit comments

Comments
 (0)