Help
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Copilot Lvl 2
Message 1 of 4

Allowing github-actions[bot] to push to protected branch

Solved! Go to Solution.

Hello,

 

I'm using Github Actions to auto approve and merge pull requests. I wasn't able to allow github-actions[bot] to push to a protected branch using the settings page though, so I ended up using the REST API instead.

Would it be possible to allow this using the settings page? or enable it by default?

protected-branch.pngThanks!

3 Replies
Solution
GitHub Staff
Message 2 of 4

Re: Allowing github-actions[bot] to push to protected branch

If we enabled GitHub Actions to push to a protected branch then any collaborator in your repo could push any code to any branch they wanted simply by creating a branch and coding the workflow to push to to some other branch.  Using the REST api to merge the PR is the right flow and overtime hopefully there will be actions that make that easier to implement.  

Copilot Lvl 2
Message 3 of 4

Re: Allowing github-actions[bot] to push to protected branch

Thanks!

 

Do you know of any possible solution to allow auto-merging as part of a workflow? I think it's a common issue.

I've looked into automerge-action and it seems to suffer the same issue, the docs suggests using a pesonal access token but from my understaing it's just as vulnerable.

Could there be any way of maybe limiting GitHub Actions to merge/push to the branch that invoked the workflow? or scoping secrets by branch? or auto-merge outside of GitHub Actions once all check runs are done?

Copilot Lvl 3
Message 4 of 4

Re: Allowing github-actions[bot] to push to protected branch

I found a partial solution to this, it allows you to have protected branches that require 1 approval and a green CI. See https://github.com/ridedott/dependabot-auto-merge-action.