-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Allow force push to protected branches #28086
Allow force push to protected branches #28086
Conversation
99d45bd
to
1febb6e
Compare
1a45601
to
90026dd
Compare
Will be able to fix CI compliance Sunday night |
90026dd
to
03326ad
Compare
52fb6a3
to
f28ecbe
Compare
Small refactor in commit f28ecbe seemed necessary due to |
this is very needed feature for our git workflow |
Please fix the lint error |
d341dc9
to
534a1fe
Compare
* giteaofficial/main: [skip ci] Updated translations via Crowdin Allow force push to protected branches (go-gitea#28086) Refactor login page (go-gitea#31530)
I'm running 1.22.0 and i'm looking all over the place for this. Where and how do i enable it? Doesn't show up on my branch protection screen. |
This is not integrated as part of 1.22.0, it is on the roadmap for 1.23.0 (might have to look around for an ETA). If you switch to nightly build it will also have changes based on current |
Fixes #22722
Problem
Currently, it is not possible to force push to a branch with branch protection rules in place. There are often times where this is necessary (CI workflows/administrative tasks etc).
The current workaround is to rename/remove the branch protection, perform the force push, and then reinstate the protections.
Solution
Provide an additional section in the branch protection rules to allow users to specify which users with push access can also force push to the branch. The default value of the rule will be set to
Disabled
, and the UI is intuitive and very similar to thePush
section.It is worth noting in this implementation that allowing force push does not override regular push access, and both will need to be enabled for a user to force push.
This applies to manual force push to a remote, and also in Gitea UI updating a PR by rebase (which requires force push)
This modifies the
BranchProtection
API structs to add:enable_force_push bool
enable_force_push_whitelist bool
force_push_whitelist_usernames string[]
force_push_whitelist_teams string[]
force_push_whitelist_deploy_keys bool
Updated Branch Protection UI:
Pull Request
Update branch by Rebase
option enabled with source branchtest
being a protected branch: