BobAnkh / auto-generate-changelog

A Github Action to generate CHANGELOG automatically according to conventional commits. Feel free to contribute!
Apache License 2.0
81 stars 22 forks source link

Can we specify which branch to push to? #58

Closed RowlandOti closed 3 years ago

RowlandOti commented 3 years ago

Hey, I'd like to specify which branch to push to, so I can avoid pushing to a protected branch. I have a branch that is protected i.e main and release for releases. Is there a way I can commit the ChangeLog to release and push?

Right now it seems to fail with the following error:

github.GithubException.GithubException: 409 {"message": "Could not update file: At least 1 approving review is required by reviewers with write access.", "documentation_url": "https://docs.github.com/articles/about-protected-branches"}

which makes me feel like it by default trying to push to the main branch, despite action or workflow being triggered by push/merge to release - which is not protected. I have my config as below:

name: Release
on:
  push:
    branches:
      - release

       - name: Generate CHANGELOG.md
        id: generate_change_log
        uses: BobAnkh/auto-generate-changelog@master
        with:
          REPO_NAME: 'RowlandOti/E-CommerceApp-Merchant'
          ACCESS_TOKEN: ${{secrets.GITHUB_TOKEN}}
          PATH: '/CHANGELOG.md'
          COMMIT_MESSAGE: 'docs(CHANGELOG): update release notes'
          TYPE: 'ci:Continuous Integration,test:Tests,feat:New Features,fix:Bug Fixes,lint:Code Style Fixes,docs:Documentation,refactor:Refactors,perf:Performance Improvements'

Please note that I do not want to change secrets.GITHUB_TOKEN to include administrators as that defeats the purpose of the branch protection.

boring-cyborg[bot] commented 3 years ago

Thanks for opening your first issue here! Be sure to follow the issue template!

gitmagic-app[bot] commented 3 years ago

Everything looks good :thumbsup:

gitmagic-app[bot] commented 3 years ago

Everything looks good :thumbsup:

RowlandOti commented 3 years ago

Figured out I could use: PATH: 'release:/CHANGELOG.md'

BobAnkh commented 3 years ago

I will update the README so that users can find this feature more easily. Thank you anyway.

github-actions[bot] commented 3 years ago

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue.