onimur/circleci-github-changelog-generator

Avoid force-push

MOPineyro opened this issue · 2 comments

When setting git-push flag the command being executed is git push -f -q https://$GITHUB_TOKEN@github.com/$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME.git master unclear why it's being force pushed and how to override.

@MOPineyro Hello, I will create a tag to perform git push with "force" and without it. As soon as I make this pull request I update this orb to a new version and let you know.

If you have any suggestions or any other questions, I will be happy to help.

@MOPineyro Done, I updated the orb to version 2.1.9.

Now if you use the git-push: true tag it will no longer be forced.
If you want the push to be forced, add the tag push-force: true

And if you still want to commit and push manually it would be something like this:

Inside the changelog job.

            pre-steps:
              - checkout
            context: your-context           # Case contain your Github Token
            token: GITHUB_TOKEN             # Token as env_var
            git-push: false                 # The changelog will be save on /tmp/.persist/persist/
            #Push the changelog to remote repository manually
            post-steps:
              - run:
                  command: |
                    git config user.name "BotUsername"
                    git config user.email "bot@email.com"
                    git add CHANGELOG.md
                    git commit -m "Your description [skip ci]"
                    git push -q https://$<<parameters.token>>@github.com/YourUser/YourProjectName.git master
            filters: *orb_tagged_filters    # Trigger to only tag