Skip to content
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

Feature - Add approved and changes requested board options #62

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TEAMWORK_URI: "localhost"
TEAMWORK_API_TOKEN: "test_api_token"
AUTOMATIC_TAGGING: true
BOARD_COLUMN_OPENED: "PR Open"
BOARD_COLUMN_APPROVED: 'PR Approved'
BOARD_COLUMN_CHANGES_REQUESTED: 'Changes Requested'
BOARD_COLUMN_MERGED: "Ready to Test"
BOARD_COLUMN_CLOSED: "Rejected"
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.idea/
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ jobs:
TEAMWORK_API_TOKEN: ${{ secrets.TEAMWORK_API_TOKEN }}
AUTOMATIC_TAGGING: false
BOARD_COLUMN_OPENED: 'PR Open'
BOARD_COLUMN_APPROVED: 'PR Approved'
BOARD_COLUMN_CHANGES_REQUESTED: 'Changes Requested'
BOARD_COLUMN_MERGED: 'Ready to Test'
BOARD_COLUMN_CLOSED: 'Rejected'
env:
Expand All @@ -73,6 +75,8 @@ Tags are added automatically on the task if you are have the option `AUTOMATIC_T

You may also specify columns you'd like the task to be moved to on every stage of the PR:
- `BOARD_COLUMN_OPENED`: The case-sensitive column name of the column you'd like the task to be moved to once the PR has been opened
- `BOARD_COLUMN_APPROVED`: The case-sensitive column name of the column you'd like the task to be moved to once the PR has been approved
- `BOARD_COLUMN_CHANGES_REQUESTED`: The case-sensitive column name of the column you'd like the task to be moved to once the PR has changes requested
- `BOARD_COLUMN_MERGED`: The case-sensitive column name of the column you'd like the task to be moved to once the PR has been merged
- `BOARD_COLUMN_CLOSED`: The case-sensitive column name of the column you'd like the task to be moved to if the PR was closed without being merged

Expand Down
10 changes: 10 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,14 @@ inputs:
description: 'The case-sensitive column name of the column you would like the task to be moved to once the PR has been opened'
required: false
default: ''
BOARD_COLUMN_APPROVED:
description: 'The case-sensitive column name of the column you would like the task to be moved to once the PR has been approved'
required: false
default: ''
BOARD_COLUMN_CHANGES_REQUESTED:
description: 'The case-sensitive column name of the column you would like the task to be moved to once the PR has changes requested'
required: false
default: ''
BOARD_COLUMN_MERGED:
description: 'The case-sensitive column name of the column you would like the task to be moved to once the PR has been merged'
required: false
Expand All @@ -37,5 +45,7 @@ runs:
- ${{ inputs.TEAMWORK_API_TOKEN }}
- ${{ inputs.AUTOMATIC_TAGGING }}
- ${{ inputs.BOARD_COLUMN_OPENED }}
- ${{ inputs.BOARD_COLUMN_APPROVED }}
- ${{ inputs.BOARD_COLUMN_CHANGES_REQUESTED }}
- ${{ inputs.BOARD_COLUMN_MERGED }}
- ${{ inputs.BOARD_COLUMN_CLOSED }}
6 changes: 4 additions & 2 deletions src/main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@ main() {
export TEAMWORK_API_TOKEN="$3"
export AUTOMATIC_TAGGING="$4"
export BOARD_COLUMN_OPENED="$5"
export BOARD_COLUMN_MERGED="$6"
export BOARD_COLUMN_CLOSED="$7"
export BOARD_COLUMN_APPROVED="$6"
export BOARD_COLUMN_CHANGES_REQUESTED="$7"
export BOARD_COLUMN_MERGED="$8"
export BOARD_COLUMN_CLOSED="$9"

env::set_environment

Expand Down
13 changes: 13 additions & 0 deletions src/teamwork.sh
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,19 @@ Review: **$review_state**
$comment
"
teamwork::add_tag "PR Approved"
teamwork::move_task_to_column "$BOARD_COLUMN_APPROVED"
elif [ "$review_state" == "changes_requested" ]; then
teamwork::add_comment "
**$user** requested changes to the PR: **$pr_title**
[$pr_url]($pr_url)

---

Review: **$review_state**
$comment
"
teamwork::add_tag "PR Changes Requested"
teamwork::move_task_to_column "$BOARD_COLUMN_CHANGES_REQUESTED"
fi
}

Expand Down
21 changes: 21 additions & 0 deletions tests/events/pull_request_changes_requested.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"action": "submitted",
"number": 1,
"pull_request": {
"body": "This is the body of the PR. https://xxxx.teamwork.com/#/tasks/123 https://xxx.teamwork.com/#/tasks/456",
"head": {
"repo": {
"full_name": "teamwork/github-sync"
}
},
"html_url": "https://github.com/teamwork/github-sync/pull/2",
"title": "This is an example of a title for the PR."
},
"review": {
"state": "changes_requested",
"body": "This is the comment of the review."
},
"sender": {
"login": "username"
}
}