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

Support unprotected file patterns #16381

Closed
jpraet opened this issue Jul 8, 2021 · 6 comments · Fixed by #16395
Closed

Support unprotected file patterns #16381

jpraet opened this issue Jul 8, 2021 · 6 comments · Fixed by #16395
Assignees
Labels
type/feature Completely new functionality. Can only be merged if feature freeze is not active. type/proposal The new feature has not been accepted yet but needs to be discussed first.

Comments

@jpraet
Copy link
Member

jpraet commented Jul 8, 2021

Currently, in the branch protection settings, "Protected file patterns" can be configured:

image

I propose to add support for configuring the counterpart of this: "Unprotected file patterns".

Users with write access to the repo should be able to push commits that only touch unprotected files directly to the otherwise protected branch.

@jpraet jpraet added type/proposal The new feature has not been accepted yet but needs to be discussed first. type/feature Completely new functionality. Can only be merged if feature freeze is not active. labels Jul 8, 2021
@lafriks
Copy link
Member

lafriks commented Jul 9, 2021

It could probably be added as selection on what behavior is expected for patterns matching

@jpraet
Copy link
Member Author

jpraet commented Jul 9, 2021

It could probably be added as selection on what behavior is expected for patterns matching

What if we want to configure both protected file patterns AND unprotected file patterns though?

@lafriks
Copy link
Member

lafriks commented Jul 14, 2021

They would be conflicting imho, how that would work?

@jpraet
Copy link
Member Author

jpraet commented Jul 15, 2021

I think they are complementary. For example:

  • protected_file_patterns: /LICENSE.md
  • unprotected_file_patterns: /docs/**

And protected_file_patterns takes precedence: when a changed path matches both protected_file_patterns and unprotected_file_patterns, it will be treated as protected.

@lafriks
Copy link
Member

lafriks commented Jul 15, 2021

But if I understand correctly that if I have write to the repo and there is unprotected_file_patterns set like in your example I would not be able to modify /LICENSE.md anyway even with no protected_file_patterns set as I can only modify files in /docs/ directory.

@jpraet
Copy link
Member Author

jpraet commented Jul 15, 2021

With unprotected_file_patterns, people with write access to the repo can modify those files even if they are not allowed to push directly to the branch. It is to allow to bypass the PR workflow.

6543 pushed a commit that referenced this issue Sep 11, 2021
Fixes #16381

Note that changes to unprotected files via the web editor still cannot be pushed directly to the protected branch. I could easily add such support for edits and deletes if needed. But for adding, uploading or renaming unprotected files, it is not trivial.

* Extract & Move GetAffectedFiles to modules/git
@go-gitea go-gitea locked and limited conversation to collaborators Oct 19, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type/feature Completely new functionality. Can only be merged if feature freeze is not active. type/proposal The new feature has not been accepted yet but needs to be discussed first.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants