feat: Added `create-summary` option that adds the changelog as Action summary
parent
ae32d567b6
commit
38e51f47d7
|
@ -3,6 +3,7 @@
|
|||
|
||||
# Editors
|
||||
.vscode
|
||||
.idea
|
||||
|
||||
# Logs
|
||||
logs
|
||||
|
|
|
@ -24,13 +24,14 @@ This action will bump version, tag commit and generate a changelog with conventi
|
|||
- **Optional** `fallback-version`: The fallback version, if no older one can be detected, or if it is the first one. Default `'0.1.0'`
|
||||
- **Optional** `config-file-path`: Path to the conventional changelog config file. If set, the preset setting will be ignored
|
||||
- **Optional** `pre-changelog-generation`: Path to the pre-changelog-generation script file. No hook by default.
|
||||
- **Optional** `skip-ci`: Adds instruction to github to not consider the push something to rebuild. Default `true`.
|
||||
- **Optional** `skip-ci`: Adds instruction to Github to not consider the push something to rebuild. Default `true`.
|
||||
- **Optional** `create-summary`: Adds the generated changelog as Action Summary. Default `false`.
|
||||
|
||||
### Pre-Commit hook
|
||||
|
||||
> Function in a specified file will be run right before the git-add-git-commit phase, when the next
|
||||
> version is already known and a new changelog has been generated. You can run any chores across your
|
||||
> repository that should be added and commited with the release commit.
|
||||
> repository that should be added and committed with the release commit.
|
||||
|
||||
Specified path could be relative or absolute. If it is relative, then it will be based on the `GITHUB_WORKSPACE` path.
|
||||
|
||||
|
|
|
@ -118,6 +118,11 @@ inputs:
|
|||
default: 'true'
|
||||
required: false
|
||||
|
||||
create-summary:
|
||||
description: 'Adds the generated changelog as Action Summary'
|
||||
default: 'false'
|
||||
required: false
|
||||
|
||||
outputs:
|
||||
changelog:
|
||||
description: 'The generated changelog for the new version'
|
||||
|
|
14
src/index.js
14
src/index.js
|
@ -44,9 +44,10 @@ async function run() {
|
|||
const preChangelogGenerationFile = core.getInput('pre-changelog-generation')
|
||||
const gitUrl = core.getInput('git-url')
|
||||
const skipCi = core.getBooleanInput('skip-ci')
|
||||
const createSummary = core.getBooleanInput('create-summary')
|
||||
|
||||
if (skipCi) {
|
||||
gitCommitMessage += " [skip ci]"
|
||||
gitCommitMessage += ' [skip ci]'
|
||||
}
|
||||
|
||||
core.info(`Using "${preset}" preset`)
|
||||
|
@ -207,6 +208,17 @@ async function run() {
|
|||
core.setOutput('tag', gitTag)
|
||||
core.setOutput('skipped', 'false')
|
||||
|
||||
if (createSummary) {
|
||||
try {
|
||||
await core.summary
|
||||
.addHeading(gitTag, 2)
|
||||
.addRaw(cleanChangelog)
|
||||
.write()
|
||||
} catch (err) {
|
||||
core.warning(`Was unable to create summary! Error: "${err}"`,)
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
// If we are running in test mode we use this to validate everything still runs
|
||||
git.testHistory()
|
||||
|
|
Loading…
Reference in New Issue