diff --git a/README.md b/README.md index edca823..f0beb43 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,7 @@ This action will bump version, tag commit and generate a changelog with conventi - **Optional** `release-count`: Number of releases to preserve in changelog. Default `5`, use `0` to regenerate all. - **Optional** `version-file`: The path to the file that contains the version to bump. Default `./package.json`. - **Optional** `version-path`: The place inside the version file to bump. Default `version`. +- **Optional** `skip-git-pull`: Do not pull the repo before tagging. Ensure you full cloned the repo in the first place to get tags. Default `'false'`. - **Optional** `skip-on-empty`: Boolean to specify if you want to skip empty release (no-changelog generated). This case occured when you push `chore` commit with `angular` for example. Default `'true'`. - **Optional** `skip-version-file`: Do not update the version file. Default `'false'`. - **Optional** `skip-commit`: Do not create a release commit. Default `'false'`. @@ -148,6 +149,22 @@ Tag only skip-commit: "true" ``` +Skip Git Pull +In CI you might not want to pull extra changes before tagging e.g. if running a long build before tagging, another commit may have come into the branch which would get pulled leading to tagging a different commit to the one which was built. + +```yaml +- name: Checkout repository + uses: actions/checkout@v2 + with: + fetch-depth: 0 + +- name: Conventional Changelog Action + uses: TriPSs/conventional-changelog-action@v3 + with: + github-token: ${{ secrets.github_token }} + skip-git-pull: "true" +``` + Use a custom file for versioning ```yaml diff --git a/action.yml b/action.yml index 2360b2c..354f3ed 100644 --- a/action.yml +++ b/action.yml @@ -70,6 +70,11 @@ inputs: default: 'version' required: false + skip-git-pull: + description: 'Do not pull the repo before tagging. Ensure you full cloned the repo in the first place to get tags' + default: 'false' + required: false + skip-on-empty: description: 'Do nothing when the changelog from the latest release is empty' default: 'true' diff --git a/src/index.js b/src/index.js index f36e63d..2220c0f 100644 --- a/src/index.js +++ b/src/index.js @@ -36,6 +36,7 @@ async function run() { const releaseCount = core.getInput('release-count') const versionFile = core.getInput('version-file') const versionPath = core.getInput('version-path') + const skipGitPull = core.getInput('skip-git-pull').toLowerCase() === 'true' const skipVersionFile = core.getInput('skip-version-file').toLowerCase() === 'true' const skipCommit = core.getInput('skip-commit').toLowerCase() === 'true' const skipEmptyRelease = core.getInput('skip-on-empty').toLowerCase() === 'true' @@ -64,8 +65,10 @@ async function run() { core.info(`Skipping empty releases is "${skipEmptyRelease ? 'enabled' : 'disabled'}"`) core.info(`Skipping the update of the version file is "${skipVersionFile ? 'enabled' : 'disabled'}"`) - core.info('Pull to make sure we have the full git history') - await git.pull() + if (!skipGitPull) { + core.info('Pull to make sure we have the full git history') + await git.pull() + } const config = conventionalConfigFile && requireScript(conventionalConfigFile)