-
Notifications
You must be signed in to change notification settings - Fork 28
Yannig hackathon #33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Yannig hackathon #33
Changes from all commits
129d3e4
b462376
8233557
f375178
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -32,21 +32,57 @@ teamwork::add_comment() { | |
| log::message "$response" | ||
| } | ||
|
|
||
| teamwork::add_tag() { | ||
| local -r tag_name=$1 | ||
|
|
||
| if [ "$ENV" == "test" ]; then | ||
| log::message "Test - Simulate request. Task ID: $TEAMWORK_TASK_ID - Tag: ${tag_name//\"/}" | ||
| return | ||
| fi | ||
|
|
||
| response=$(curl -X "PUT" "$TEAMWORK_URI/projects/api/v1/tasks/$TEAMWORK_TASK_ID/tags.json" \ | ||
| -u "$TEAMWORK_API_TOKEN"':' \ | ||
| -H 'Content-Type: application/json; charset=utf-8' \ | ||
| -d "{ \"tags\": { \"content\": \"${tag_name//\"/}\" } }" ) | ||
|
|
||
| log::message "$response" | ||
| } | ||
|
|
||
| teamwork::remove_tag() { | ||
| local -r tag_name=$1 | ||
|
|
||
| if [ "$ENV" == "test" ]; then | ||
| log::message "Test - Simulate request. Task ID: $TEAMWORK_TASK_ID - Tag: ${tag_name//\"/}" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This line is for testing, I would add to the message something like "Removed tag". |
||
| return | ||
| fi | ||
|
|
||
| response=$(curl -X "PUT" "$TEAMWORK_URI/projects/api/v1/tasks/$TEAMWORK_TASK_ID/tags.json" \ | ||
| -u "$TEAMWORK_API_TOKEN"':' \ | ||
| -H 'Content-Type: application/json; charset=utf-8' \ | ||
| -d "{ \"tags\": { \"content\": \"${tag_name//\"/}\" },\"removeProvidedTags\":\"true\" }" ) | ||
|
|
||
| log::message "$response" | ||
| } | ||
|
|
||
| teamwork::pull_request_opened() { | ||
| local -r pr_url=$(github::get_pr_url) | ||
| local -r pr_title=$(github::get_pr_title) | ||
| local -r user=$(github::get_sender_user) | ||
| local -r pr_stats=$(github::get_pr_patch_stats) | ||
| local -r pr_body=$(github::get_pr_body) | ||
| IFS=" " read -r -a pr_stats_array <<< "$pr_stats" | ||
|
|
||
| teamwork::add_comment " | ||
| **$user** opened a PR: **$pr_title** | ||
| [$pr_url]($pr_url) | ||
|
|
||
| --- | ||
| ${pr_body//###/####} | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So replace all hading level 3 for level 4 headings isn't it?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So, it's getting anything from 3, 4, 5 to 4,5.. I hope we are not using 2... And just because lvl 3 looks good in github, but way too big in Projects 😊 |
||
| --- | ||
|
|
||
| 🔢 ${pr_stats_array[0]} commits / 📝 ${pr_stats_array[1]} files updated / ${pr_stats_array[2]} additions / ${pr_stats_array[3]} deletions | ||
| " | ||
|
|
||
| teamwork::add_tag "PR Open" | ||
| } | ||
|
|
||
| teamwork::pull_request_closed() { | ||
|
|
@@ -60,11 +96,14 @@ teamwork::pull_request_closed() { | |
| **$user** merged a PR: **$pr_title** | ||
| [$pr_url]($pr_url) | ||
| " | ||
| teamwork::add_tag "PR Merged" | ||
| teamwork::remove_tag "PR Open" | ||
| else | ||
| teamwork::add_comment " | ||
| **$user** closed a PR without merging: **$pr_title** | ||
| [$pr_url]($pr_url) | ||
| " | ||
| teamwork::remove_tag "PR Open" | ||
| fi | ||
| } | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,7 +2,7 @@ | |
| "action": "opened", | ||
| "number": 1, | ||
| "pull_request": { | ||
| "body": "This is the body of the PR. https://xxxx.teamwork.com/#/tasks/123 https://xxx.teamwork.com/#/tasks/456", | ||
| "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\r\n\r\n#### `<ConditonRow/>`\r\n- UI Explanation\r\n\r\n- Blank State\r\n\r\n- Empty State for not provided values\r\n - Tags\r\n \r\n - Companies\r\n \r\n- Validation Errors\r\n - Tags\r\n \r\n - Companies\r\n \r\n- Row Error (loading data error)\r\n\r\n- All Possible Condition Rows\r\n", | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a public repository, we shouldn't be exposing our internal URLs. I would create a generic JSON just for testing purposes. |
||
| "head": { | ||
| "repo": { | ||
| "full_name": "teamwork/github-sync" | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line is for testing, I would add to the message something like "Added tag".