phips28 / gh-action-bump-version

GitHub Action for automated npm version bump.
MIT License
330 stars 251 forks source link

Version bump failed on protected branch #156

Open gyi123 opened 2 years ago

gyi123 commented 2 years ago

I have set up a branch protection rule to run a few simple unit tests before code is merged. However, once the rule is enabled, I am having issue using the version bump. Here is the error messge in github action: ✖ fatal remote: error: GH006: Protected branch update failed for refs/heads/main.
remote: error: 2 of 2 required status checks are expected.

Any idea on how to resolve this? The protection rule is set up on pull request.

Thanks

George

leandrooriente commented 2 years ago

I imagine you have a private Github Token, if that is the case, try this:

steps:
  - name: 'Checkout source code'
    uses: 'actions/checkout@v2'
    with:
        persist-credentials: false
        ref: ${{ github.ref }}
  - name: 'Automated Version Bump'
        id: version-bump
        uses: 'phips28/gh-action-bump-version@master'
        env:
            GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

The secret is the persist-credentials: false on the checkout action.

andirsun commented 2 years ago

@leandrooriente does not work.

version action after first waterfall: patch
version action after final decision: patch
currentBranch: dev
current 1: 4.0.18 / version: patch
newVersion 1: 4.0.19
✖  fatal     fatal: could not read Username for 'https://github.com': No such device or address
git exited with code 1[28](https://github.com/webalys-hq/streamline-web/runs/6970316668?check_suite_focus=true#step:3:29)
✖  fatal     Failed to bump version
ph250167 commented 1 year ago

@leandrooriente does not work.

version action after first waterfall: patch
version action after final decision: patch
currentBranch: dev
current 1: 4.0.18 / version: patch
newVersion 1: 4.0.19
✖  fatal     fatal: could not read Username for 'https://github.com': No such device or address
git exited with code 1[28](https://github.com/webalys-hq/streamline-web/runs/6970316668?check_suite_focus=true#step:3:29)
✖  fatal     Failed to bump version

I'm having this same issue in one repo, but not another. Same token, same action setup. It works in one repo, but fails with this same error in another. Any ideas? I'm using the latest version of the action, but have tried several of the past releases to no avail.

OfirYaron commented 7 months ago

Having same issue with this action, tried to add persist-credentials: false - did not work. is there a fix/additional setting that needs to be made here?

DannyBo-Affilomania commented 4 months ago

When adding persist-credentials: false im getting ✖ fatal fatal: could not read Username for 'https://github.com': No such device or address Otherwise, getting the same issue as OP. Any idea why that happens? @phips28

cthompson-avb commented 2 months ago

I found this action which can push to protected branches by using a personal access token: https://github.com/CasperWA/push-protected

tranlehaiquan commented 2 days ago

For support "The protection rule is set up on pull request." I think the action should support option to create pull request instead of direct commit.