Github: Protect a branch but let service accounts push to it - github

I have a personal website on GitHub Pages. When I merge into develop, my CI is set up to check out master, reset --hard to develop, build the website, and force push to GitHub.
Is there a way I can protect master from being pushed to by anyone else than my CI's service account, so that the only way to update my website is by pushing a verified build to develop?
Since I don't have an organization account, I can't restrict to a particular user using the feature described in this answer.

Related

Can sync 2 GitHub accounts together? Enterprise to personal?

I have a GitHub Enterprise account from school and I have a personal GitHub account. Throughout my course I have been uploading all of my projects to the enterprise account and although I am told I would have "lifetime" access to said enterprise account, I would still like my work to be attached to my personal account.
Is there a way I could link or sync both of my accounts together? Or a way if I push a repo to my enterprise account it will also push to my personal account at the same time?
The answer is yes, you can push your repo's to multiple GitHub accounts. When you first pull from an account, you have access to said account until further notice, even after you exit your terminal. All you need to do is to push your files to the "main" branch of each GitHub account.
For example. My schools repo main branch is not called "main" it is called "master." So after all the commits I would just git push origin master . This will push it to school. My personal account however is named main. So right after I push to my school I can just git push origin main and it will push it to my personal. Using these two back to back works just fine and it does not matter which one you use first.

Can I set up Github repo to autoapprove and merge PRs from a specific user?

I'm working with hundreds of github repos (mostly Terraform) and every now and then I need to push a change all across those repos (typically version upgrade). Each has multiple branches and requires PR review before merge to master. Is there a way I can set it up so that PRs created by my automation account do not require approval before merge?
There is an hmarr/auto-approve-action action, which you can configure to auto-approve PR from certain users.
In your case, that could allow you to push as a dedicated user PRs that will be automatically approved by this action.

github branch restriction on personal account

I want to restrict commits to only few collaborators in few branches. I have personal account in github but donot have any facility to do so as that of organisation. Any suggestion is much appreciated.
You can always use GitHub's standard forking workflow:
Each collaborator will fork your repository and do their work in their own fork.
When something is ready to be contributed back to your repository the developer will create a pull request that you will review.
That code will only be merged into your repository if you approve it and accept the pull request.
In this way you control the code that gets merged into each of your branches.

Github allow some specific non-admin users to push changes to a protected branch where all other uses have to create a pull request

This is for Jenkins where I don't want the Jenkins user as a Github admin but I want it to add 1 to the build number (which for iOS happens to be in the info.plist) commit + push it as part of our build process. Adding 1 to the build number is the easy bit.
However, I generally want all users to be forced to create pull requests on this branch and have the branch as protected.
If I add the jenkins user (nickm01 below) to the "allowed to push to branch" list, that user still seems to have to create a pull request to push a commit.
How can I configure things differently?
See below for our branch settings. Unfortunately our jenkins user "nickm01" still has to create a PR in order to push changes.

Github to launchpad sync

I am working on a open source project which uses bazaar for versioning and launchpad for repo. The project also has github repo but launchpad repo is primary. I am behind college proxy so i can't access ssh required to connect to launchpad to merge/push changes. Is there a way, that i commit, push all changes on my github account, and they get reflected on my launchpad account too. Can I send merge requests too?
This will give you overall idea , how to do that
create your project test in github and will be owned by organization name Acc.
then just push the master branch to test
Now fork the project and clone
Push all your local branches to your GitHub fork git push -a origin
And checkout that branch using git checkout <branch_name>. And then push to origin of that branch.
Launchpad is a project-centric environment, so you will most likely have a GitHub organization that owns the ‘main’ repository and encourage all members and newcomers to fork from that.
within fork developer can able to work on that, usually when about to issue a pull request – GitHub’s version of a merge proposal, pull down changes from the upstream organization master into their master. Since this will happen relatively often it is easiest to add an additional ‘remote’ target for it:
git remote add acc `http://github.com/acc/test.git`