I am trying to use lerna publish to manage package publishing in my team. So what lerna does at the end of every publish is, it bumps the version in the package.json
file and commits those changes in the branch that did the publish.
However in master I need "Require pull request reviews before merging"
to be active as it is protected branch.
My problem is not in publishing as lerna publishes the package. However the circle-ci fails with this error:
remote: error: GH006: Protected branch update failed for refs/heads/publish-test.
remote: error: At least 1 approving review is required by reviewers with write access.
To github.com:username/repo.git
! [remote rejected] publish-test -> publish-test (protected branch hook declined)
I tried enabling "Restrict who can push to matching branches"
option to allow a user to commit in master, (we are using a bot user for devops commits).
Is there a way to add a user exception to the option "Require pull request reviews before merging"
or do a pre-merge hook(so I can publish before the merge in ci)?
Update: GitHub Enterprise now has the ability to create custom roles in which you can assign the permission to bypass branch policy.
The only way to exempt users is to make them repo admins and allow admins to bypass the policy.
Or use a GitHub actions workflow that uses the PAT if an admin to push to the target branch if the changes were pushed by allow-listed users. That opens up some interesting security issues though.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With