-
Notifications
You must be signed in to change notification settings - Fork 207
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
Failed to push to a protected branch #3
Comments
I haven't tested it, but I'm pretty sure it's the option "Restrict who can push to matching branches". It seems to be the same issue that a similar project faced: renovatebot/renovate#846. They solved it by registering a separate account, I am afraid there is currently no way to work around this, unless GitHub changes the way these restrictions are applied, for example by adding a checkbox "Allow GitHub actions to push" or similar. Sorry that I don't have any better news for you! |
@pascalgn I've followed your lead and removed this restriction. Full log:
|
oops, thanks for the report! That's an actual bug! It's fixed now in v0.1.1, to update change your main.workflow to update the uses part like this:
|
@pascalgn so, now it works for the case where I set the "automerge" label after all checks (CI) have passed. Full log:
|
I too have this issue - on a company repo we use the "Restrict who can push to matching branches" option to restrict company users to repos. Is it not possible to change the github user that the action uses? I can't find any documentation about doing this so I presume not right now. On a separate note, I have a fork of this action that allows configuration of the merge method so that I can use the https://github.com/rob-murray/automerge-action/tree/allow-squash-merge-option |
Thanks for the input! As you have the same issue as @YosBD, I had a look again and I came up with a quick solution which is hopefully OK for you: There is now a new configuration option To use it, you need to update to the latest version by updating your main.workflow file:
You also will need to generate a token for the user you want to use. Make sure to check The token will look like Make sure to add it as secret, as the token should be kept secure!
All API requests (merge/rebase) will then be executed as the specified user, which you should be able to add to the list of users allowed to merge. Hope this helps! Regarding the squash merge option, I personally don't need it, but I think it will make a lot of sense because then all 3 merge options would be covered, so please go ahead and open a PR for it :) |
@pascalgn awesome, thanks 👍 I will tidy up the code, updated the README and do a PR soon, thanks. |
Thanks for the hint about keeping the token secret, that's a very good point! I updated the README accordingly. |
Although not ideal, I think the |
Is there no better workaround in 2021? |
Still no option to somehow elevate the workflows' |
Hi, I'm getting the following error on a pull request which is targeted to a protected branch:
INFO Failed to merge PR: You're not authorized to push to this branch. Visit https://help.github.com/articles/about-protected-branches/ for more information.
Full log:
The text was updated successfully, but these errors were encountered: