release-changelog-builder-action ... a GitHub action that builds your release notes / changelog fast, simple and exactly the way you want. Quickstart 🛠️ • Configuration • Placeholders • Sample 🖥️ • Reference 📖 • License 📓 🏷️ Categorised by label | categories maps PR labels onto sections — one PR can land in several, or in none | 🧩 Templated end to end | template, prtemplate and…
[!NOTE]
All input values are optional. It is only required to provide the token either via the input, or as env variable.
Input
Description
configurationJson
Provide the configuration directly via the build yml file. Please note that ${{}} has to be written as #{{}} within the yml file.
configuration
Relative path, to the configuration.json file, providing additional configurations
outputFile
Optional relative path to a file to store the resulting changelog in.
owner
The owner of the repository to generate the changelog for
repo
Name of the repository we want to process
fromTag
Defines the ‘start’ from where the changelog will consider merged pull requests (can be a tag or a valid git ref)
toTag
Defines until which tag the changelog will consider merged pull requests (can be a tag or a valid git ref)
path
Allows to specify an alternative sub directory, to use as base
token
Alternative config to specify token. You should prefer env.GITHUB_TOKEN instead though
baseUrl
Alternative config to specify base url for GitHub Enterprise authentication. Default value set to https://api.github.com
includeOpen
Enables to also fetch currently open PRs. Default: false
ignorePreReleases
Allows to ignore pre-releases for changelog generation (E.g. for 1.0.1… 1.0.0-rc02 <- ignore, 1.0.0 <- pick). Only used if fromTag was not specified. Default: false
failOnError
Defines if the action will result in a build failure if problems occurred. Default: false
fetchViaCommits
Enables PRs to get fetched via the commits identified between from->to tag. This will do 1 API request per commit -> Best for scenarios with squash merges
fetchReviewers
Will enable fetching the users/reviewers who approved the PR. Default: false
fetchReleaseInformation
Will enable fetching additional release information from tags. Default: false
fetchReviews
Will enable fetching the reviews on of the PR. Default: false
mode
Defines the mode used to retrieve the information. Available options: [PR, COMMIT, HYBRID]. Defaults to PR. Hybrid mode treats commits like pull requests. Commit mode is a special configuration for projects which work without PRs. Uses commit messages as changelog. This mode looses access to information only available for PRs. Formerly set as commitMode: true, this setting is now deprecated and should be converted to mode: "COMMIT". Note: the commit or hybrid modes are not fully supported.
offlineMode
[EXPERIMENTAL] Enables offline mode which disables API requests to GitHub or Gitea. Only works with commitMode and retrieves tags and diffs from the local repository. Default: false
exportCache
Will enable exporting the fetched PR information to a cache, which can be re-used by later runs. Default: false
exportOnly
When enabled, will result in only exporting the cache, without generating a changelog. Default: false (Requires exportCache to be enabled)
cache
The file path to write/read the cache to/from.
includeOnlyPaths
List of path patterns to include. Provide as multiline input (one per line). Only commits that touched these paths will be included in the changelog. Useful for monorepo setups where you want to filter commits by their affected paths. GitHub (non-offline mode): when includeOnlyPaths is defined, the action performs an extra API call per commit to determine which files were modified by that commit. This can significantly increase API usage for large diffs.
[!WARNING] ${{ secrets.GITHUB_TOKEN }} only grants rights to the current repository, for other repositories please use a PAT (Personal Access Token).
Action outputs
After action execution it will return the changelog and additional information as step output. You can use it in any follow-up step by referencing the output by referencing it via the id of the step. For example build_changelog.
A full set list of possible output values for this action.
Output
Description
outputs.changelog
The built release changelog built from the merged pull requests
outputs.owner
Specifies the owner of the repository processed
outputs.repo
Describes the repository name, which was processed
outputs.fromTag
Defines the fromTag which describes the lower bound to process pull requests for
outputs.toTag
Defines the toTag which describes the upper bound to process pull request for
outputs.failed
Defines if there was an issue with the action run, and the changelog may not have been generated correctly. [true, false]
outputs.pull_requests
Defines a , joined array with all PR IDs associated with the generated changelog.
outputs.categorized_prs
Count of PRs which were successfully categorized as part of the action.
outputs.open_prs
Count of open PRs. Only fetched if includeOpen is enabled.
outputs.uncategorized_prs
Count of PRs which were not categorized as part of the action.
outputs.changed_files
Count of changed files in this release.
outputs.additions
Count of code additions in this release (lines).
outputs.deletions
Count of code deletions in this release (lines).
outputs.changes
Total count of changes in this release (lines).
outputs.commits
Count of commits which have been added in this release.
outputs.contributors
The contributors of this release. Based on PR authors only.
outputs.categorized
The categorized pull requests used to build the changelog as serialized JSON.
outputs.cache
The file pointing to the cache for the current fetched data. Can be provided to another action step.
Customization 🖍️
Note
[!IMPORTANT]
When running this action for non tags trigger the toTag will be automatically resolved using the latest tag as retrieved by the git API.
[!NOTE]
The first release tag is a special case since there is no previous release the action can reference to. For this case, there are two options:
When checking out the source via git (E.g.: actions/checkout), the action will use the first commit.
Create an initial tag on the commit you want to begin a changelog from (for example v0.0.1).
[!NOTE]
By default not specifying fromTag or toTag will resolve toTag from either the ref or alternatively fallback to the latest tag from the git API. fromTag is resolved by sorting tags using semver. Tags not following semver are filtered out. Check the configuration for alternatives.
[!NOTE]
If you are behind a corporate HTTP proxy, you can set the https_proxy environment variable to the proxy URL. For reference, please see the Octokit documentation.
Configuration
The action supports flexible and extensive configuration options to fine-tune it for the specific projects needs. To do so provide the configuration either directly to the step via configurationJson or as file via the configuration.
[!WARNING]
It is required to have a checkout step prior to the changelog step if configuration is used, to allow the action to discover the configuration file. Use configurationJson as alternative.
[!NOTE]
Defaults for the configuration can be found in the configuration.ts
[!NOTE]
It is possible to provide the configuration as file and as json via the yml file. The order of config values used: configurationJson > configuration > DefaultConfiguration.
The configuration is a JSON in the following format. (The below showcases example configurations for all possible options. In most scenarios most of the settings will not be needed, and the defaults will be appropriate.)
Table of supported placeholders allowed to be used in the template and empty_template (only supports placeholder marked for empty) configuration, to give additional control on defining the contents of the release notes / changelog.
Placeholder
Description
Empty
#{{CHANGELOG}}
The contents of the changelog, matching the labels as specified in the categories configuration
#{{UNCATEGORIZED}}
All pull requests not matching a specified label in categories
#{{OPEN}}
All open pull requests. Will only be fetched if includeOpen is enabled.
#{{IGNORED}}
All pull requests defining labels matching the ignore_labels configuration
#{{OWNER}}
Describes the owner of the repository the changelog was generated for
x
#{{REPO}}
The repository name of the repo the changelog was generated for
x
#{{FROM_TAG}}
Defines the ‘start’ from where the changelog did consider merged pull requests
x
#{{FROM_TAG_DATE}}
Defines the date at which the ‘start’ tag was created. Requires fetchReleaseInformation.
x
#{{TO_TAG}}
Defines until which tag the changelog did consider merged pull requests
x
#{{TO_TAG_DATE}}
Defines the date at which the ‘until’ tag was created. Requires fetchReleaseInformation.
x
#{{RELEASE_DIFF}}
Introduces a link to the full diff between from tag and to tag releases
x
#{{CHANGED_FILES}}
The count of changed files.
#{{ADDITIONS}}
The count of code additions (lines).
#{{DELETIONS}}
The count of code deletions (lines).
#{{CHANGES}}
The count of total changes (lines).
#{{COMMITS}}
The count of commits in this release.
#{{CONTRIBUTORS}}
The contributors of this release. Based on PR Authors only.
#{{CATEGORIZED_COUNT}}
The count of PRs which were categorized
#{{UNCATEGORIZED_COUNT}}
The count of PRs and changes which were not categorized. No label overlapping with category labels
#{{OPEN_COUNT}}
The count of open PRs. Will only be fetched if includeOpen is configured.
#{{IGNORED_COUNT}}
The count of PRs and changes which were specifically ignored from the changelog.
#{{DAYS_SINCE}}
Days between the 2 releases. Requires fetchReleaseInformation to be enabled.
x
PR Template placeholders
Table of supported placeholders allowed to be used in the pr_template configuration, which will be included in the release notes / changelog.
Placeholder
Description
#{{NUMBER}}
The number referencing this pull request. E.g. 13.
#{{TITLE}}
Specified title of the merged pull request.
#{{URL}}
Url linking to the pull request on GitHub.
#{{STATUS}}
Status of the PR. Usually always merged. Possibly Open if includeOpen is configured.
#{{CREATED_AT}}
The ISO time, the pull request was created at.
#{{MERGED_AT}}
The ISO time, the pull request was merged at.
#{{MERGE_SHA}}
The commit SHA, the pull request was merged with.
#{{AUTHOR}}
Author creating and opening the pull request.
#{{AUTHOR_NAME}}
The name of the Author creating and opening the pull request (Can be empty).
#{{LABELS}}
The labels associated with this pull request, joined by ,.
#{{MILESTONE}}
Milestone this PR was part of, as assigned on GitHub.
#{{BODY}}
Description/Body of the pull request as specified on GitHub.
#{{ASSIGNEES}}
Login names of assigned GitHub users, joined by ,.
#{{REVIEWERS}}
GitHub Login names of specified reviewers, joined by ,. Requires fetchReviewers to be enabled.
#{{APPROVERS}}
GitHub Login names of users who approved the PR, joined by ,.
[!IMPORTANT] v4 updates the default placeholders format to #{{}}. The old format ${{}} will be supported until v5 for backwards compatibility.
Array Placeholders
Table of special array placeholders allowed to be used in the pr_template configuration.
Array placeholders follow the following format: (KEY)[(*/index)] for example: ASSIGNEES[*] or ASSIGNEES[0].
When using * values are joined by ,.
Placeholder
Description
#{{ASSIGNEES[*]}}
Login names of assigned GitHub users.
#{{REVIEWERS[*]}}
GitHub Login names of specified reviewers. Requires fetchReviewers to be enabled.
#{{APPROVERS[*]}}
GitHub Login names of users who approved the PR.
Additionally, there are special array placeholders like REVIEWS which allows access to it’s properties via
(KEY)[(*/index)].(property).
For example: REVIEWS[*].author or REVIEWS[*].body
Placeholder
Description
#{{REVIEWS[*].author}}
GitHub Login names of specified reviewers.
#{{REVIEWS[*].body}}
The body of the review.
#{{REVIEWS[*].htmlURL}}
The URL to the given review.
#{{REVIEWS[*].submittedAt}}
The date went he review was submitted.
#{{REVIEWS[*].state}}
The state of the given review.
Similar to REVIEWS, REFERENCED PRs also offer special placeholders.
Placeholder
Description
#{{REFERENCED[*].number}}
The PR number of the referenced PR.
#{{REFERENCED[*].title}}
The title of the referenced PR.
#{{REFERENCED[*]."..."}}
Allows to use most other PR properties as placeholder.
Commit Template placeholders
Table of supported placeholders allowed to be used in the commit_template configuration, which will be included in the release notes / changelog. Applies to HYBRID and COMMIT modes only.
Placeholder
Description
#{{NUMBER}}
Always 0.
#{{TITLE}}
The commit summary.
#{{STATUS}}
Always merged.
#{{CREATED_AT}}
The ISO time of the commit.
#{{MERGE_SHA}}
The commit SHA.
#{{AUTHOR}}
The username of the commit Author.
#{{AUTHOR_NAME}}
The name of the commit Author (Can be empty).
#{{BODY}}
The commit message.
Configuration Specification
Table of descriptions for the configuration.json options to configure the resulting release notes / changelog.
Input
Description
categories
An array of category specifications, offering a flexible way to group changes into categories.
category.key
Optional key used for the categorized json output.
category.title
The display name of a category in the changelog.
category.collapsed
Wrap the category and its nested categories in a closed <details> block. Markdown heading markers in title are removed from the summary. Empty categories remain omitted unless empty_content is set. Default: false.
category.labels
An array of labels, to match pull request labels against. If any PR label matches any category label, the pull request will show up under this category. (See exhaustive to change this)
category.exclude_labels
Similar to labels, an array of labels to match PRs against, but if a match occurs the PR is excluded from this category.
category.exhaustive
Will require all labels defined within this category to be present on the matching PR.
category.exhaustive_rules
Will require all rules defined within this category to be valid on the matching PR. If not defined, defaults to the value of exhaustive
category.empty_content
If the category has no matching PRs, this content will be used. When not set, the category will be skipped in the changelog.
category.rules
An array of rules used to match PRs against. Any match will include the PR. (See exhaustive to change this)
category.rules.pattern
A regex pattern to match the property value towards. Uses RegExp.test("val")
category.rules.flags
Defines the regex flags specified for the pattern. Default: gu.
Defines if this category applies to PRs, commits or both. Allowed values: PR, COMMIT, HYBRID. Default: HYBRID.
ignore_labels
An array of labels, to match pull request labels against. If any PR label overlaps, the pull request will be ignored from the changelog. This takes precedence over category labels
sort
A sort specification, offering the ability to define sort order and property.
sort.order
The sort order. Allowed values: ASC, DESC
sort.on_property
The property to sort on. Allowed values: mergedAt, title
template
Specifies the global template to pick for creating the changelog. See Template placeholders for possible values
Defines the per commit template. Used in HYBRID and COMMIT modes only. If empty, uses the template defined for pr_template. See Commit Template placeholders for possible values.
empty_template
Template to pick if no changes are detected. See Template placeholders for possible values
label_extractor.[{<EXTRACTOR>}]
An array of Extractor specifications, offering a flexible API to extract additional labels from a PR. Please see the documentation related to Regex Configuration for more details.
duplicate_filter.{<EXTRACTOR>}
Defines the Extractor to use for retrieving the identifier for a PR. In case of duplicates will keep the last matching pull request (depends on sort). Please see the documentation related to Regex Configuration for more details.
reference.{<EXTRACTOR>}
Defines the Extractor to use for resolving the “PR-number” for a parent PR. In case of a match, the child PR will not be included in the release notes. Please see the documentation related to Regex Configuration for more details.
transformers.[{<REGEX>}]
An array of Regex specifications, offering a flexible API to modify the text per pull request. This is applied on the change text created with pr_template. transformers are executed per change, in the order specified. Please see the documentation related to Regex Configuration for more details.
max_tags_to_fetch
The maximum amount of tags to load from the API to find the previous tag. Loaded paginated with 100 per page
max_pull_requests
The maximum amount of pull requests to load from the API. Loaded paginated with 30 per page
max_back_track_time_days
Defines the max amount of days to go back in time per changelog
exclude_merge_branches
An array of branches to be ignored from processing as merge commits
tag_resolver
Section to provide configuration for the tag resolving logic. Used if no fromTag is provided
tag_resolver.method
Defines the method to use. Current options are: semver, sort. Default: semver
tag_resolver.filter
Defines a regex object which is used to filter out tags not matching.
tag_resolver.transformer.{<REGEX>}
Defines a regex transformer used to optionally transform the tag after the filter was applied. Allows to adjust the format to e.g. semver. Please see the documentation related to Regex Configuration for more details.
base_branches
The target branches for the merged PR, ignores PRs with different target branch. Values can be a regex. Default: allow all base branches
trim_values
Defines if all values inserted in templates are trimmed. Default: false
Regex Configuration
Since v5.x or newer, the regex configuration was unified to allow the same functionalities to be used for the various use-cases.
This applies to all configurations outlined in Configuration Specification and Custom placeholders that allow a regex object.
Input
Description
.pattern
The regex pattern to use
.target
The result pattern. The result text will be used as label. If empty, no label is created. (Usage depends on the method used for the regex).
Javascript methods (replace, replaceAll, match) define the regex in JavaScript format (e.g. double backslash to escape a dot \.). For example to include all matching tags and exclude the rest, use negative lookahead to exclude tags. For example, api.* will only include tags starting with “api”, ^(?!alpha).* will exclude all tags starting with “alpha”.
.method
The extraction method used. Defaults to: replace. Alternative values: replaceAll, match. These methods specified references the JavaScript String method. And a special method regexr, that functions similar to the list within the regexr tool.
.flags
Defines the regex flags specified for the pattern. Default: gu.
.on_empty
Defines the placeholder to be filled in, if the regex does not lead to a result.
.on_property
This is available for Extractor type regex objects. With the property describing a field available in PRs. (e.g.: title, body, …) Default: body.
This example will look for JIRA tickets in the EPIC project, and extract all of these tickets. The exciting part for that case is, that the ticket is PR-bound but can be used in the global TEMPLATE, but equally also in the PR template. This is unique for CUSTOM PLACEHOLDERS as standard placeholders do not offer this functionality.
Input
Description
custom_placeholders
An array of Placeholder specifications, offering a flexible API to extract custom placeholders from existing placeholders.
custom_placeholders.name
The name of the custom placeholder. Will be used within the template.
custom_placeholders.source
The source PLACEHOLDER, requires to be one of the existing Template or PR Template placeholders.
custom_placeholders.transformer.{<REGEX>}
The transformer specification used to extract the value from the original source PLACEHOLDER. Please see the documentation related to Regex Configuration for more details.
A placeholder with the name as CUSTOM_PLACEHOLDER can be used as #{{CUSTOM_PLACEHOLDER}} in the target template.
By default the same restriction applies as for PR vs. template placeholder. E.g. a global placeholder can only be used in the global template (and not in the PR template).
Custom placeholders offer one new feature, though. PR-related placeholders can be used in the global template via the following syntax:
评论