Skip to content

Commit

Permalink
Add the ability for comments to be optionally private
Browse files Browse the repository at this point in the history
  • Loading branch information
christian-thomas committed Jul 17, 2023
1 parent 7738030 commit 05bc1ec
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 9 deletions.
8 changes: 4 additions & 4 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ inputs:
AUTOMATIC_TAGGING:
description: 'Do you want to enable automatic tagging: true/false'
required: false
# MAKE_COMMENTS_PRIVATE:
# description: 'Do you want to make all comments private to your organisation: true/false'
# required: false
MAKE_COMMENTS_PRIVATE:
description: 'Do you want to make all comments private to your organisation: true/false'
required: false
BOARD_COLUMN_OPENED:
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
Expand All @@ -39,7 +39,7 @@ runs:
- ${{ inputs.TEAMWORK_URI }}
- ${{ inputs.TEAMWORK_API_TOKEN }}
- ${{ inputs.AUTOMATIC_TAGGING }}
# - ${{ inputs.MAKE_COMMENTS_PRIVATE }}
- ${{ inputs.MAKE_COMMENTS_PRIVATE }}
- ${{ inputs.BOARD_COLUMN_OPENED }}
- ${{ inputs.BOARD_COLUMN_MERGED }}
- ${{ inputs.BOARD_COLUMN_CLOSED }}
8 changes: 4 additions & 4 deletions src/main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ main() {
export TEAMWORK_URI="$2"
export TEAMWORK_API_TOKEN="$3"
export AUTOMATIC_TAGGING="$4"
# export MAKE_COMMENTS_PRIVATE="$5"
export BOARD_COLUMN_OPENED="$5"
export BOARD_COLUMN_MERGED="$6"
export BOARD_COLUMN_CLOSED="$7"
export MAKE_COMMENTS_PRIVATE="$5"
export BOARD_COLUMN_OPENED="$6"
export BOARD_COLUMN_MERGED="$7"
export BOARD_COLUMN_CLOSED="$8"

env::set_environment

Expand Down
11 changes: 10 additions & 1 deletion src/teamwork.sh
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,16 @@ teamwork::add_comment() {
response=$(curl -X "POST" "$TEAMWORK_URI/tasks/$TEAMWORK_TASK_ID/comments.json" \
-u "$TEAMWORK_API_TOKEN"':' \
-H 'Content-Type: application/json; charset=utf-8' \
-d "{ \"comment\": { \"body\": \"${body//\"/}\", \"notify\": true, \"content-type\": \"text\", \"isprivate\": true }" )
-d "{
\"comment\": {
\"body\": \"${body//\"/}\",
\"notify\": true,
\"content-type\":
\"text\",
\"isprivate\": $([ "$MAKE_COMMENTS_PRIVATE" == true ] && echo true || echo false)
}
}"
)

log::message "$response"
}
Expand Down

0 comments on commit 05bc1ec

Please sign in to comment.