Skip to content

Commit 31a99c3

Browse files
ychartoisyannig
andauthored
Yannig hackathon fixes (#34)
* better tags workflow * PR review from Miguel, the easy part :) * Add a new line at the end of the body to prevent a weird Teamwork bug that change the size of the text Co-authored-by: yannig <[email protected]>
1 parent 19a8da4 commit 31a99c3

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

src/teamwork.sh

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ teamwork::add_tag() {
3636
local -r tag_name=$1
3737

3838
if [ "$ENV" == "test" ]; then
39-
log::message "Test - Simulate request. Task ID: $TEAMWORK_TASK_ID - Tag: ${tag_name//\"/}"
39+
log::message "Test - Simulate request. Task ID: $TEAMWORK_TASK_ID - Tag Added: ${tag_name//\"/}"
4040
return
4141
fi
4242

@@ -52,7 +52,7 @@ teamwork::remove_tag() {
5252
local -r tag_name=$1
5353

5454
if [ "$ENV" == "test" ]; then
55-
log::message "Test - Simulate request. Task ID: $TEAMWORK_TASK_ID - Tag: ${tag_name//\"/}"
55+
log::message "Test - Simulate request. Task ID: $TEAMWORK_TASK_ID - Tag Removed: ${tag_name//\"/}"
5656
return
5757
fi
5858

@@ -76,7 +76,7 @@ teamwork::pull_request_opened() {
7676
**$user** opened a PR: **$pr_title**
7777
[$pr_url]($pr_url)
7878
---
79-
${pr_body//###/####}
79+
${pr_body//###/####} \n
8080
---
8181
8282
🔢 ${pr_stats_array[0]} commits / 📝 ${pr_stats_array[1]} files updated / ${pr_stats_array[2]} additions / ${pr_stats_array[3]} deletions
@@ -98,12 +98,14 @@ teamwork::pull_request_closed() {
9898
"
9999
teamwork::add_tag "PR Merged"
100100
teamwork::remove_tag "PR Open"
101+
teamwork::remove_tag "PR Approved"
101102
else
102103
teamwork::add_comment "
103104
**$user** closed a PR without merging: **$pr_title**
104105
[$pr_url]($pr_url)
105106
"
106107
teamwork::remove_tag "PR Open"
108+
teamwork::remove_tag "PR Approved"
107109
fi
108110
}
109111

@@ -125,6 +127,7 @@ teamwork::pull_request_review_submitted() {
125127
Review: **$review_state**
126128
$comment
127129
"
130+
teamwork::add_tag "PR Approved"
128131
fi
129132
}
130133

tests/events/pull_request_opened.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"action": "opened",
33
"number": 1,
44
"pull_request": {
5-
"body": "### Task\r\n- [Implement Smart Inbox Settings](https://digitalcrew.teamwork.com/#tasks/21419431)\r\n - Implement `<ConditionsBuilder/>`\r\n - Implement `<ConditonRow/>`\r\n\r\n### Screencap\r\n#### `<ConditionsBuilder/>`\r\n![conditionsbuilder](https://user-images.githubusercontent.com/621330/52656284-abc69580-2efe-11e9-89af-9b0dab68c494.gif)\r\n\r\n#### `<ConditonRow/>`\r\n- UI Explanation\r\n![conditionrow](https://user-images.githubusercontent.com/621330/52656775-bb92a980-2eff-11e9-8492-4b550b584a1e.png)\r\n- Blank State\r\n![blankconditionrow](https://user-images.githubusercontent.com/621330/52656835-e2e97680-2eff-11e9-994e-1ff426a6b7e9.png)\r\n- Empty State for not provided values\r\n - Tags\r\n ![notags](https://user-images.githubusercontent.com/621330/52656880-fa286400-2eff-11e9-8206-fee059f08356.png)\r\n - Companies\r\n ![nocompanies](https://user-images.githubusercontent.com/621330/52656897-04e2f900-2f00-11e9-82b4-88e7f58b05d7.png)\r\n- Validation Errors\r\n - Tags\r\n ![notselectedtagerror](https://user-images.githubusercontent.com/621330/52656942-2643e500-2f00-11e9-9d06-7ec813e35c2b.png)\r\n - Companies\r\n ![notselectedcompanyerror](https://user-images.githubusercontent.com/621330/52656955-2e038980-2f00-11e9-8ede-5738fb0fdd74.png)\r\n- Row Error (loading data error)\r\n![conditionrowunexpectederror](https://user-images.githubusercontent.com/621330/52656976-3b207880-2f00-11e9-9a9f-f01c3c417715.png)\r\n- All Possible Condition Rows\r\n![allpossibleconditions](https://user-images.githubusercontent.com/621330/52657021-5be8ce00-2f00-11e9-91e1-910730e4bef6.png)",
5+
"body": "This is the body of the PR. https://xxxx.teamwork.com/#/tasks/123 https://xxx.teamwork.com/#/tasks/456",
66
"head": {
77
"repo": {
88
"full_name": "teamwork/github-sync"

0 commit comments

Comments
 (0)