Release pull request templates
tagpr uses a Go text template to render the complete release pull request. You can replace the default template with either a file or inline text.
Output format
The first non-empty rendered line becomes the pull request title. All remaining rendered content becomes the pull request body.
For example, this template:
Release {{.NextVersion}}
Merging this pull request will create {{.NextVersion}}.
{{.Changelog}}produces Release v1.2.3 as the title and uses the remaining Markdown as the body.
Available variables
| Variable | Description | Example |
|---|---|---|
.NextVersion | Proposed version, including v when enabled but excluding tagPrefix | v1.2.3 |
.Branch | Branch used for the release pull request | tagpr-from-v1.2.2 |
.Changelog | Generated release notes returned by GitHub | ## What's Changed ... |
.TagPrefix | Normalized monorepo tag prefix without the trailing slash | tools |
Use .TagPrefix when the same template serves multiple projects:
{{if .TagPrefix}}[{{.TagPrefix}}] {{end}}Release {{.NextVersion}}
{{.Changelog}}Template file
Set tagpr.template to the template path:
[tagpr]
template = .github/tagpr-template.mdThe path is relative to the repository root when using the GitHub Action, even when the
.tagpr configuration is in a subdirectory.
For a monorepo:
# tools/.tagpr
[tagpr]
tagPrefix = tools
template = tools/.github/tagpr-template.mdInline template
Set tagpr.templateText or TAGPR_TEMPLATE_TEXT to provide the template directly. A
multiline environment variable is convenient in GitHub Actions:
- uses: Songmu/tagpr@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAGPR_TEMPLATE_TEXT: |
Release {{.NextVersion}}
This release is prepared from {{.Branch}}.
{{.Changelog}}When both tagpr.template and tagpr.templateText are set, the template file takes
precedence.
Changelog placement
Include {{.Changelog}} where GitHub’s generated release notes should appear. Omitting
it removes those notes from the release pull request body. When
tagpr.changelog = false is also set, tagpr skips release-note generation while
preparing the release pull request because neither the template nor the changelog file
uses the result.
.Changelog is evaluated lazily. References in unused template definitions or
conditional branches that are not executed do not generate release notes.
Omitting .Changelog does not by itself disable changelog-file updates or GitHub
Release generation. An enabled changelog still requires notes while preparing the
release pull request, and an enabled GitHub Release generates fresh notes after merge.
See Changelog and GitHub Releases for how those notes are generated.
Invalid templates
If tagpr cannot parse the configured template, or rendering fails, it logs the error and falls back to its built-in default template.