logo
1
1
Login

changelog

Generate changelog based on historical commit information between two versions. By default, it will be generated to the CHANGELOG.md file in the working directory.

Note:

  • Not supported in branch.delete events
  • The first tag of the repository does not support generating changelog. It needs to be generated from the second tag
  • If there are no eligible changes between two tags, changelog cannot be generated

Parameters

tag

  • type: String
  • required: No
  • default: The tag name that triggered the pipeline

The tag used to generate the changelog (get changes between previousTag | previousBranch and tag to generate the changelog)

previousTag

  • type: String
  • required: No
  • default: The previous version (tag) sorted by creation time

The previous version tag used to generate the changelog, with higher priority than previousBranch. If provided, the changelog is generated from changes between previousTag and tag; If not provided, the changelog is generated from changes between tag and the previous tag

previousBranch

  • type: String
  • required: No

The previous version (branch name) used to generate the changelog. If provided, the changelog is generated from changes between previousBranch and tag; If not provided, the changelog is generated from changes between tag and the previous tag

from

  • type: String
  • required: No

Used to generate the changelog written to the target file. If provided, the log is generated starting from the from version; otherwise, it starts from the first version

target

  • type: String
  • required: No
  • default: CHANGELOG.md

Modify the file path for generating logs. This field is invalid when dryRun: true or day: xxx is set. The starting version of the log written to the file is from. If from does not exist, it starts from the first version. Not affected by tag and previousTag.

latestChangeLogTarget

  • type: String
  • required: No

Specify the file path for the latest changelog (changes between previousTag and tag). This field is invalid when dryRun: true or day is set.

dryRun

  • type: Boolean
  • required: No
  • default: false

Only generate and directly return the changelog from the previous version to now (If previousTag and tag are provided, generate the changelog between these two), content is in the output result;

If this field is set, the log will not be written to a file, i.e., the target field is invalid. And day is invalid

day

  • type: String
  • required: No

Get a summary of commits in the recent period, content is in the output result

  • 1: Within the last 1 day, starting from 00:00 of the current day
  • 2: Within the last 2 days, starting from 00:00 of yesterday
  • 7: Within the last 7 days
  • 2022-12-02: Starting from a specific day
  • 2022-12-02 11:00:00: Starting from a specific time point

If this field is set, the log will not be written to a file, i.e., the target field is invalid. And tag and previousTag are invalid

discard

  • type: Boolean
  • required: No
  • default: false

Whether to discard some commits, only keeping those that have version change impacts in semantic versioning

linkReferences

  • type: Boolean
  • required: No
  • default: true

Whether to display associated links, including commits and issues, etc.

showIssue

  • type: Boolean
  • required: No
  • default: true

Whether to identify and display issue IDs, supports identifying the #123 format

showPr

  • type: Boolean
  • required: No
  • default: true

Whether to identify and display PR IDs. Supports identifying the PR-URL: #123 format

showCommitTime

  • type: Boolean
  • required: No
  • default: true

Whether to display the code commit time

Output Result

{ latestChangeLog, // The latest changelog }

Using on Docker

docker run --rm -t -v $(pwd):$(pwd) -w $(pwd) cnbcool/changelog .

Using on Cloud Native Build

Generate CHANGELOG.md file:

# .cnb.yml $: tag_push: - stages: - name: changelog image: cnbcool/changelog - name: showfile script: ls -al CHANGELOG.md

Export as a variable and send to a group:

# .cnb.yml $: tag_push: - stages: - name: Generate changelog image: cnbcool/changelog settings: dryRun: true linkReferences: false exports: latestChangeLog: RELEASE_NOTES - name: Echo changelog script: echo "$RELEASE_NOTES" - name: Send to enterprise group image: tencentcom/wecom-message settings: robot: your-bot-xxxxxxx content: | ## ChangeLog $RELEASE_NOTES

Automatically generate weekly reports at 3 PM every Friday:

# .cnb.yml $: # At 3 PM every Friday "crontab: 0 15 * * 5": - stages: - name: week changelog image: cnbcool/changelog settings: day: 7 dryRun: true linkReferences: false exports: latestChangeLog: WEEK_REPORT - name: wework notice image: tencentcom/wecom-message settings: robot: your-bot-xxxxxxx content: | ## ChangeLog $WEEK_REPORT

Use latestChangeLogTarget to write the changelog between the current tag and the previous tag to a custom file:

# .cnb.yml $: tag_push: - stages: - name: Generate changelog image: cnbcool/changelog settings: latestChangeLogTarget: LATEST_CHANGELOG.md - name: Show latest changelog script: cat LATEST_CHANGELOG.md

About

根据历史提交信息生成 changelog

513.00 KiB
1 forks1 stars5 branches1 TagREADMEMIT license
Language
TypeScript82.6%
Dockerfile7.2%
Handlebars6.5%
JavaScript2.9%
Others0.8%