Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add --no-git-commit option to changelog command #2258

Merged

Conversation

megatroom
Copy link
Contributor

What Changed

Add --no-git-commit option to changelog command.

With this new parameter it will be possible to change the CHANGELOG.md file without it doing the unwanted git commit.

changelog

Why

Following the Do-It-Yourself topic in the documentation, I made this script to customize my project's deployment. It's working fine, but it's generating two commits due to the changelog command committing without being able to avoid it.

Commits-·-megatroom-components-to-markdown

With this new parameter I will be able to make a single commit to save the changes to the CHANGELOG.md and package.json files.

Below is an example of a script using this new feature:

export PATH=$(npm bin):$PATH

# Exit immediately if a command fails
set -e

VERSION=`auto version`

## Support for label 'skip-release'
if [ ! -z "$VERSION" ]; then
  ## Update Changelog
  auto changelog --no-git-commit

  ## Generate new version
  TAG_NAME=$(npm --no-git-tag-version version $VERSION)
  VERSION_NUMBER=$(echo "$TAG_NAME" | cut -c2-)

  ## Publish Package
  npm publish

  ## Commit the changes
  git add CHANGELOG.md package.json
  git commit -m "[skip ci] Bump version to: $VERSION_NUMBER"
  git tag -a $TAG_NAME -m "Version $VERSION_NUMBER"

  ## Create GitHub Release
  git push --follow-tags --set-upstream origin $branch
  auto release --use-version=$TAG_NAME
fi

Todo:

  • Add tests
  • Add docs

Change Type

Indicate the type of change your pull request is:

  • documentation
  • patch
  • minor
  • major

@hipstersmoothie hipstersmoothie added the minor Increment the minor version when merged label Sep 21, 2022
@hipstersmoothie hipstersmoothie merged commit 19febe4 into intuit:main Feb 8, 2023
@github-actions
Copy link

github-actions bot commented Feb 8, 2023

🚀 PR was released in v10.40.0 🚀

@github-actions github-actions bot added the released This issue/pull request has been released. label Feb 8, 2023
@megatroom megatroom deleted the add-no-git-commit-option-to-changelog branch February 25, 2023 13:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
minor Increment the minor version when merged released This issue/pull request has been released.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants