Have automatic tagging as an option by ychartois · Pull Request #35 · Teamwork/github-sync · GitHub
Skip to content
Merged
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
1 change: 1 addition & 0 deletions .github/workflows/test.yml
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TEAMWORK_URI: ${{ secrets.TEAMWORK_URI }}
TEAMWORK_API_TOKEN: ${{ secrets.TEAMWORK_API_TOKEN }}
AUTOMATIC_TAGGING: false

```

Expand All @@ -59,7 +60,7 @@ Please note, the comment will be created in Teamwork under the account you have

![Teamwork pr comment](./.github/assets/teamwork_pr_comment.png)

Tags are added automatically on the task:
Tags are added automatically on the task if you are have the option `AUTOMATIC_TAGGING` set to `true` and the tag exists in you targeting project:
- A new PR is open: tag `PR Open`
- A PR is approved: tag `PR Approved` added
- A PR is merged: tags `PR Open` and `PR Approved` removed, tag `PR merged` added
Expand Down
4 changes: 4 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,14 @@ inputs:
TEAMWORK_API_TOKEN:
description: 'Teamwork API token'
required: true
AUTOMATIC_TAGGING:
description: 'Do you want to enable automatic tagging: true/false'
required: false
runs:
using: 'docker'
image: 'Dockerfile'
args:
- ${{ inputs.GITHUB_TOKEN }}
- ${{ inputs.TEAMWORK_URI }}
- ${{ inputs.TEAMWORK_API_TOKEN }}
- ${{ inputs.AUTOMATIC_TAGGING }}
2 changes: 1 addition & 1 deletion src/main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ main() {
# Ensure env vars and args exist
ensure::env_variable_exist "GITHUB_REPOSITORY"
ensure::env_variable_exist "GITHUB_EVENT_PATH"
ensure::total_args 3 "$@"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think about checking if TEAMWORK_API_TOKEN exists as well? Isn't it mandatory as well?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we don't need to check it because it's already defined as mandatory in the YML file.


export GITHUB_TOKEN="$1"
export TEAMWORK_URI="$2"
export TEAMWORK_API_TOKEN="$3"
export AUTOMATIC_TAGGING="$4"

env::set_environment

Expand Down
18 changes: 11 additions & 7 deletions src/teamwork.sh