logo
0
0
WeChat Login

tapd-status-helper

Introduction

Based on the input text or file containing TAPD work item source code keywords, change the work item status to the specified state.

Parameters

  • endpoint: String, optional, TAPD API address. When empty, the default address https://api.tapd.cn will be used.
  • access_token: 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.
  • from_text: String, optional, text containing TAPD work item source code keywords.
  • from_file: String, optional, text file containing TAPD work item source code keywords.
  • workspace_id: Number, required, filter condition, workspace ID. Extract work items from from_text or from_file whose workspace ID matches this parameter.
  • type: 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.
  • when: String, optional, filter condition, only update work items whose status meets the specified condition.
  • status: String, required, change the status of filtered work items to the target status.

Note: from_text and from_file cannot both be empty. Priority: from_text > from_file.

Usage in Cloud Native Build

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/**

In branch.create event

For branch creation events, you can include story-${id} or bug-${id} in the branch name, such as:

  • feature/story-1000017
  • fix/bug-1000008

Then 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

In push event

# .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

In pull_request event

# .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

In tag_push event

# .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

Usage in Docker

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

About

TAPD状态扭转助手

440.00 KiB
0 forks0 stars1 branches3 TagREADMEMIT license
Language
JavaScript88.4%
Shell8.6%
Dockerfile3%