Skip to content
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

Wildcard Protected Branch #2529

Closed
Andlix opened this issue Sep 17, 2017 · 16 comments · Fixed by #20825
Closed

Wildcard Protected Branch #2529

Andlix opened this issue Sep 17, 2017 · 16 comments · Fixed by #20825
Assignees
Labels
issue/confirmed Issue has been reviewed and confirmed to be present or accepted to be implemented type/feature Completely new functionality. Can only be merged if feature freeze is not active.
Milestone

Comments

@Andlix
Copy link

Andlix commented Sep 17, 2017

With the last version, you could only protect branches that exists. But I think it should also be possible to protect branches given as wildcard (similar to GitLab),
e.g.
pu/*
release/*
*-stable
{user}/* (this branch should be protected except {user}

I think it would be a good idea to set these attitudes globally for an organization.

@lafriks lafriks added the type/feature Completely new functionality. Can only be merged if feature freeze is not active. label Sep 17, 2017
@lafriks lafriks added this to the 1.x.x milestone Sep 17, 2017
@stale
Copy link

stale bot commented Feb 12, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions.

@stale stale bot added the issue/stale label Feb 12, 2019
@lunny lunny added issue/confirmed Issue has been reviewed and confirmed to be present or accepted to be implemented and removed issue/stale labels Feb 12, 2019
@mbarinc
Copy link

mbarinc commented Sep 16, 2019

there are news about this feature?

@lafriks
Copy link
Member

lafriks commented Sep 18, 2019

I'm thinking to work on this for 1.11 version

@lafriks lafriks modified the milestones: 1.x.x, 1.11.0 Sep 18, 2019
@lafriks lafriks self-assigned this Sep 18, 2019
@mbarinc
Copy link

mbarinc commented Sep 23, 2019

thank you @lafriks

@davidsvantesson
Copy link
Contributor

davidsvantesson commented Oct 21, 2019

I think it would be a good idea to set these attitudes globally for an organization.

I think that should be a separate issue / pr to not make this too big. It need to consider some thing, like should it be a default branch setting that can be changed or deactivated in each repository?

With wildcard support it is possible that several settings match one branch, so the priority / combination of different branch protections need to be considered. Should only the first matching branch be used (means it must be possible to order them) or the most restrictive or the most permissive setting be used? What if there are different users/teams configured in different matching branch protection settings?

@mbarinc
Copy link

mbarinc commented Jan 3, 2020

This is a very useful feature especially if it can be set at the organization level.
It's possible to put this issue in the next release 1.12?

@6543
Copy link
Member

6543 commented Jan 3, 2020

@mbarinc if someone has a PR for 1.12 or is working on it?

@lunny
Copy link
Member

lunny commented Jan 3, 2020

@6543 I think no PR for this currently.

@zerlas
Copy link

zerlas commented May 26, 2021

@lafriks any news about this, it should be really cool to get this feature especially for organizations

@zedar187
Copy link

zedar187 commented Mar 9, 2022

I would like to bump this issue. Having a wildcard on * (as in "all branches", thus the complete repo) would be sufficient for the start, I guess. This way you can set general settings to the wildcard (thus on a repo level) and override the settings of single branches using the branch dropdown.

@99rgosse
Copy link
Contributor

I will take a look at it, if I can help !
we are interested too :)

@frankhommers
Copy link

I need this to. Especially for release/* ;-)

@sIspravnikov
Copy link

I'm interested too, it can be very usefull for repos with dozens of branches, that need to be protected

@99rgosse
Copy link
Contributor

99rgosse commented May 5, 2022

Until I find some time on this, I made a workaround with a webhook and some api calls... it's quite fast and reliable !

@frankhommers
Copy link

@99rgosse can you explain your setup. It's kind of dangerous without.

@99rgosse
Copy link
Contributor

99rgosse commented Jul 1, 2022

Hello @frankhommers here is the repository : https://github.com/99rgosse/branch_protection
I'll try to keep this updated ;)

@lunny lunny modified the milestones: 1.x.x, 1.19.0 Oct 19, 2022
lunny added a commit that referenced this issue Jan 16, 2023
This PR introduce glob match for protected branch name. The separator is
`/` and you can use `*` matching non-separator chars and use `**` across
separator.

It also supports input an exist or non-exist branch name as matching
condition and branch name condition has high priority than glob rule.

Should fix #2529 and #15705

screenshots

<img width="1160" alt="image"
src="https://user-images.githubusercontent.com/81045/205651179-ebb5492a-4ade-4bb4-a13c-965e8c927063.png">

Co-authored-by: zeripath <[email protected]>
@go-gitea go-gitea locked and limited conversation to collaborators May 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
issue/confirmed Issue has been reviewed and confirmed to be present or accepted to be implemented type/feature Completely new functionality. Can only be merged if feature freeze is not active.
Projects
None yet
Development

Successfully merging a pull request may close this issue.