Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Avoiding protected branches

See original GitHub issue

Hi, I’d like to create a Github Action which will create and push a commit everytime a new release is created. Although the branch (push: origin main) I’m willing to push into is protected and needs at least 2 reviews (and some additional checks), so I receive the following message (also as an admin, I can push directly to main branch):

Error: Error: Pushing to
POST git-receive-pack (686 bytes)
remote: error: GH006: Protected branch update failed for refs/heads/main.        
remote: error: 3 of 3 required status checks are expected. At least 2 approving reviews are required by reviewers with write access.

Can you provide me some hints on how to solve this issue? I tried to provide my author_name and author_email for impersonating my admin rights, but it didn’t really work. Thanks

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

arniesahacommented, Dec 17, 2021

Thanks for the replies, folks!

Yes using a pat works! 😃

JacekArdanowskicommented, Dec 17, 2021

Hi, I made it work with below configuration:

- name: Checkout main repository
      uses: actions/checkout@v2
        token: _my_token_
        fetch-depth: 0
- name: Commit to source control
   uses: EndBug/add-and-commit@v7
        branch: main
        author_name: my_login
        push: origin main

Unfortunately this commit triggers CI as expected, so I guess it’s a trade-off 😉

Read more comments on GitHub >

github_iconTop Results From Across the Web

Protected branches - GitLab Docs
Delete a protected branch · On the top bar, select Main menu > Projects and find your project. · On the left sidebar,...
Read more >
About protected branches - GitHub Docs
You can protect important branches by setting branch protection rules, which define whether collaborators can delete or force push to the branch and...
Read more >
Protected branches · Project · User · Help · GitLab
Configuring protected branches · Navigate to your project's Settings ➔ Repository · Scroll to find the Protected branches section. · From the Branch...
Read more >
Protecting the master branch
In your repository navigation to Settings > Branches · Under “Protected Branches” select master · Enable the following settings: Protect this branch; Require...
Read more >
Best Practices for Branch Protection - DEV Community ‍ ‍
Branch protection is part of a powerful set of configuration options that give repository administrators the ability to enforce security ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found