Based on the provided text or file containing TAPD work item source code keywords, this tool updates the status of the work items to a specified state.
String, optional, TAPD API address. If empty, the default address https://api.tapd.cn is used.String, required, personal access token for TAPD. For https://tapd.cn, it can be generated at https://www.tapd.cn/personal_settings/index?tab=personal_token.String, optional, text containing TAPD work item source code keywords.String, optional, file containing TAPD work item source code keywords.Number, required, filter condition, workspace ID. Extracts work items from from_text or from_file whose workspace ID matches this parameter.String, required, filter condition, work item type. Extracts work items from from_text or from_file whose type matches this parameter. Possible values: story or bug.String, optional, filter condition, updates are only performed if the work item status meets the specified condition.String, required, updates the filtered work items to the target status.Note:
from_textandfrom_filecannot both be empty. Priority:from_text>from_file.
First, create a file in the secret repository to store the access_token, such as tapd.yml, with the following content:
# tapd.yml
TAPD_ACCESS_TOKEN: xxxx
# Declare the repository paths allowed to reference this file
allow_slugs: your-group/**
# .cnb.yml
dev: # Development branch
push:
- imports: https://cnb.cool/your-group/xxx/tapd.yml # Reference the file from the secret repository
stages:
- name: tapd-status-helper
image: tencentcom/tapd-status-helper
settings:
access_token: $TAPD_ACCESS_TOKEN # Reference from the secret repository file
from_text: $CNB_COMMIT_MESSAGE # Extract from commit message
workspace_id: xxxx # Workspace ID
type: story # Work item type
status: 开发中 # Target status
# .cnb.yml
main: # Main branch
pull_request:
- imports: https://cnb.cool/your-group/xxx/tapd.yml # Reference the file from the secret repository
stages:
- name: git-commit-list
image: tencentcom/git-commit-list
settings:
toFile: commit-list.json # Output commit list to a file
- name: tapd-status-helper
image: tencentcom/tapd-status-helper
settings:
access_token: $TAPD_ACCESS_TOKEN # Reference from the 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: 已实现 # Target status
# .cnb.yml
$: # Catch-all for all tag names
tag_push:
- imports: https://cnb.cool/your-group/xxx/tapd.yml # Reference the file from the secret repository
stages:
- name: git-commit-list
image: tencentcom/git-commit-list
settings:
tagFormat: v* # Filter the previous tag that matches the tagFormat
toFile: commit-list.json # Output commit list to a file
- name: tapd-status-helper
image: tencentcom/tapd-status-helper
settings:
access_token: $TAPD_ACCESS_TOKEN # Reference from the 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: 已完成 # Target status
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