Based on the input text or file containing TAPD work item source code keywords, change the work item status to the specified state.
String, optional, TAPD API address. When empty, the default address https://api.tapd.cn will be used.String, required, Personal access token for TAPD. For https://tapd.cn, you can generate it at https://www.tapd.cn/personal_settings/index?tab=personal_token.String, optional, text containing TAPD work item source code keywords.String, optional, text file containing TAPD work item source code keywords.Number, required, filter condition, workspace ID. Extract work items from from_text or from_file whose workspace ID matches this parameter.String, required, filter condition, work item type. Extract work items from from_text or from_file whose type matches this parameter. Possible values are story or bug.String, optional, filter condition, only update work items whose status meets the specified condition.String, required, change the status of filtered work items to the target status.Note:
from_textandfrom_filecannot both be empty. Priority:from_text>from_file.
First, create a new file in the secret repository to store access_token, such as tapd.yml, with the following content:
# tapd.yml
TAPD_ACCESS_TOKEN: xxxx
# Declare allowed repository paths that can reference this file
allow_slugs: your-group/**
For branch creation events, you can include story-${id} or bug-${id} in the branch name, such as:
feature/story-1000017fix/bug-1000008Then set the from_text parameter value to CNB_BRANCH.
# .cnb.yml
feature/*: # development branch
branch.create:
- imports: https://cnb.cool/your-group/xxx/tapd.yml # reference file from secret repository
stages:
- name: tapd-status-helper
image: tencentcom/tapd-status-helper
settings:
access_token: $TAPD_ACCESS_TOKEN # reference from secret repository file
from_text: $CNB_BRANCH # extract from branch name
workspace_id: xxxx # workspace ID
type: story # work item type
status: developing
# .cnb.yml
dev: # development branch
push:
- imports: https://cnb.cool/your-group/xxx/tapd.yml # reference file from secret repository
stages:
- name: tapd-status-helper
image: tencentcom/tapd-status-helper
settings:
access_token: $TAPD_ACCESS_TOKEN # reference from secret repository file
from_text: $CNB_COMMIT_MESSAGE # extract from commit message
workspace_id: xxxx # workspace ID
type: story # work item type
status: testing
# .cnb.yml
main: # main branch
pull_request:
- imports: https://cnb.cool/your-group/xxx/tapd.yml # reference file from secret repository
stages:
- name: git-commit-list
image: tencentcom/git-commit-list
settings:
toFile: commit-list.json # output commit list to file
- name: tapd-status-helper
image: tencentcom/tapd-status-helper
settings:
access_token: $TAPD_ACCESS_TOKEN # reference from secret repository file
from_file: commit-list.json # extract from the file output by the above plugin
workspace_id: xxxx # workspace ID
type: story # work item type
status: implemented
# .cnb.yml
$: # catch-all for all tag names
tag_push:
- imports: https://cnb.cool/your-group/xxx/tapd.yml # reference file from secret repository
stages:
- name: git-commit-list
image: tencentcom/git-commit-list
settings:
tagFormat: v* # filter previous tag that matches tagFormat
toFile: commit-list.json # output commit list to file
- name: tapd-status-helper
image: tencentcom/tapd-status-helper
settings:
access_token: $TAPD_ACCESS_TOKEN # reference from secret repository file
from_file: commit-list.json # extract from the file output by the above plugin
workspace_id: xxxx # workspace ID
type: story # work item type
status: released
docker run --rm \
-e TZ=Asia/Shanghai \
-e PLUGIN_ACCESS_TOKEN='xxx' \
-e PLUGIN_WORKSPACE_ID='xxx' \
-e PLUGIN_ENDPOINT='https://api.tapd.cn' \
-e PLUGIN_FROM_TEXT="xxx" \
-e PLUGIN_STATUS='test' \
-e PLUGIN_TYPE='story' \
-v $(pwd):$(pwd) \
-w $(pwd) \
tapd-status-helper