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

Error on protected branch #161

Closed
oc-stephen-bennett opened this issue May 3, 2022 · 4 comments
Closed

Error on protected branch #161

oc-stephen-bennett opened this issue May 3, 2022 · 4 comments

Comments

@oc-stephen-bennett
Copy link

Hi,

Im trying to semver tags on a protected master branch. I have the following setup:

master branch protection:

  • require a pull request before merging

    • requre approvals
    • require code owners
    • allow specified actors to bypass required pull request ( myself)

    I created a PAT for myself and added that as a secret (BYPASS)

action looks like below:

name: Push
on:
  push:
    branches: [ master ]
  workflow_dispatch:
jobs:
  push:
    runs-on: ubuntu-latest

    steps:
      - name: Checkout source code
        uses: 'actions/checkout@v2'
        with:
          ref: ${{ github.ref }}

      - name: Automated Version Bump
        id: version-bump
        uses: 'phips28/gh-action-bump-version@master'
        env:
          GITHUB_TOKEN: ${{ secrets.BYPASS }}
        with:
          skip-tag: 'false'

I have a CODEOWNERS file that is like below:

* @org/myself
! package.json

When i run the action i still get the error:

git commit failed because you are using "actions/checkout@v2"; but that doesnt matter because you dont need that git commit, thats only for "actions/checkout@v1"
✖  fatal     remote: error: GH006: Protected branch update failed for refs/heads/master.        
remote: error: Waiting on code owner review from openc/devops.        
To https://github.com/openc/oc-github-repository.git
 ! [remote rejected] master -> master (protected branch hook declined)
error: failed to push some refs to 'https://github.com/openc/oc-github-repository.git'

git exited with code 1
✖  fatal     Failed to bump version

Is there a work around to keep a master branch protected while enabling your action?

@phips28
Copy link
Owner

phips28 commented May 3, 2022

I only know where user used an admin user token to bypass all checks. But never used it myself.

@oc-stephen-bennett
Copy link
Author

Hi,

I am an admin on the org and gave the PAT full access, is that what you mean? or is there another PAT you can use?

@phips28
Copy link
Owner

phips28 commented May 10, 2022

#156

@oc-stephen-bennett
Copy link
Author

Sorry forgot i opened this, yes thats how i resolved it as well. though doing so did break other steps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants