diff --git a/.gitignore b/.gitignore index acefc27b..1f8a5be8 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ # Editors .vscode +.idea # Logs logs diff --git a/README.md b/README.md index 36aa835b..ce50955d 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/action.yml b/action.yml index a5a3b779..5e02fc0e 100644 --- a/action.yml +++ b/action.yml @@ -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' diff --git a/src/index.js b/src/index.js index c0d9c9f1..fcfcb129 100644 --- a/src/index.js +++ b/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()