logo
0
1
Login
feat: 支持tag_push事件

git-commit-list

Fetch commit history list, supports exporting commit list JSON data to a file.

Applicable Events

  • push, branch.create
  • tag_push
  • pull_request, pull_request.target, pull_request.mergeable, pull_request.merged

Parameters

  • toFile: Optional, output commit list to a file, defaults to commit-list.json.
  • tagFormat: Optional, in tag_push, filter the previous tag that matches the specified format and compare it with the current tag. The current tag must match the tagFormat. Defaults to *.

Usage in Cloud-Native Build

main: push: - stages: - name: git-commit-list image: tencentcom/git-commit-list:latest settings: # Optional, output commit list to a file toFile: commit-list.json pull_request: - stages: - name: git-commit-list image: tencentcom/git-commit-list:latest settings: # Optional, output commit list to a file toFile: commit-list.json $: tag_push: - stages: - name: git-commit-list image: tencentcom/git-commit-list:latest settings: # Optional, filter the previous tag that matches the v* format tagFormat: v* # Optional, output commit list to a file toFile: commit-list.json

commit-list.json Data Format

[ { "id": "ee0738cc39660baa47e08b6ef3b9f942165d1a0a", "short_id": "ee0738cc", "author_name": "name", "author_email": "name@xxx.com", "create_at": "2022-11-24T16:26:48+08:00", "message": "fix: Fetch commit history list\n\n#123", "title": "fix: Fetch commit history list" } ]

Docker

Push Event

docker run --rm \ -e TZ=Asia/Shanghai \ # Event name -e CNB_EVENT="push" \ # Commit ID before this commit -e CNB_BEFORE_SHA="xxx" \ # Latest commit ID -e CNB_COMMIT="xxx" \ # Relative path to the file for storing commit list JSON data -e PLUGIN_TOFILE="commit-list.json" \ -v $(pwd):$(pwd) \ -w $(pwd) \ tencentcom/git-commit-list:latest

PR Event

docker run --rm \ -e TZ=Asia/Shanghai \ # Event name -e CNB_EVENT="pull_request" \ # Source branch name of the MR -e CNB_PULL_REQUEST_BRANCH="xxx" \ # Target branch name of the MR -e CNB_BRANCH="master" \ # Latest commit ID -e CNB_COMMIT="xxx" \ # Relative path to the file for storing commit list JSON data -e PLUGIN_TOFILE="commit-list.json" \ -v $(pwd):$(pwd) \ -w $(pwd) \ tencentcom/git-commit-list:latest