logo
0
0
Login
docs: 增加tag_push例子

tapd-status-helper

Introduction

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.

Parameters

  • endpoint: String, optional, TAPD API address. If empty, the default address https://api.tapd.cn is used.
  • access_token: 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.
  • from_text: String, optional, text containing TAPD work item source code keywords.
  • from_file: String, optional, file containing TAPD work item source code keywords.
  • workspace_id: Number, required, filter condition, workspace ID. Extracts work items from from_text or from_file whose workspace ID matches this parameter.
  • type: 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.
  • when: String, optional, filter condition, updates are only performed if the work item status meets the specified condition.
  • status: String, required, updates the 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 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/**

In Push Event

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

In Pull Request Event

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

In Tag Push Event

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

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