diff --git a/README.md b/README.md index c8825aa..a2a66cf 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,7 @@ This action will bump version, tag commit and generate a changelog with conventi - **Optional** `preset`: Preset that is used from conventional commits. Default `angular`. - **Optional** `tag-prefix`: Prefix for the git tags. Default `v`. - **Optional** `output-file`: File to output the changelog to. Default `CHANGELOG.md`. +- **Optional** `changelog-release-count`: Number of releases to preserve in changelog. Default `5`, use `0` to regenerate all. ## Example usage @@ -21,4 +22,5 @@ This action will bump version, tag commit and generate a changelog with conventi preset: 'angular' tag-prefix: 'v' output-file: 'CHANGELOG.md' + changelog-release-count: 5 ``` diff --git a/action.yml b/action.yml index 98cd9f0..308ab82 100644 --- a/action.yml +++ b/action.yml @@ -32,3 +32,8 @@ inputs: description: 'File to output the changelog to' default: 'CHANGELOG.md' required: false + + changelog-release-count: + description: 'Number of releases to preserve in changelog' + default: 5 + required: false \ No newline at end of file diff --git a/src/helpers/generateChangelog.js b/src/helpers/generateChangelog.js index a519dc9..8e30ecf 100644 --- a/src/helpers/generateChangelog.js +++ b/src/helpers/generateChangelog.js @@ -1,10 +1,10 @@ const fs = require('fs') const conventionalChangelog = require('conventional-changelog') -module.exports = (tagPrefix, preset, jsonPackage, fileName) => new Promise((resolve) => { +module.exports = (tagPrefix, preset, jsonPackage, fileName, releaseCount) => new Promise((resolve) => { const changelogStream = conventionalChangelog({ preset, - releaseCount: 5, + releaseCount, }, { version: jsonPackage.version, diff --git a/src/index.js b/src/index.js index ab75e43..4015e86 100644 --- a/src/index.js +++ b/src/index.js @@ -11,6 +11,7 @@ async function run() { const tagPrefix = core.getInput('tag-prefix') const preset = core.getInput('preset') const outputFile = core.getInput('output-file') + const releaseCount = core.getInput('changelog-release-count') core.info(`Using "${preset}" preset`) @@ -33,7 +34,7 @@ async function run() { core.info(`New version: ${jsonPackage.version}`) // Generate the changelog - await generateChangelog(tagPrefix, preset, jsonPackage, outputFile) + await generateChangelog(tagPrefix, preset, jsonPackage, outputFile, releaseCount) core.info('Push all changes')