Skip to content

Conversation

@wolfgangwalther
Copy link
Contributor

This disallows the creation of new branches in the nixpkgs repo with the following exceptions:

  • backport-, revert- and wip- branches can be created by anyone.
  • nixos- and nixpkgs- branches can be created by the channel updaters.
  • release- and staging- branches can be created by the release team.

This does not affect any existing branches, which we can fade out over time instead.

This is work towards #118, although I wouldn't close that issue with this, yet. There's more ideas in there, some of which I'd need to move to the nixpkgs repo's CI as well. But also the clarification of "development branches" for some other branch protection rules.

This disallows the creation of new branches in the nixpkgs repo with the
following exceptions:
- `backport-`, `revert-` and `wip-` branches can be created by anyone.
- `nixos-` and `nixpkgs-` branches can be created by the channel
updaters.
- `release-` and `staging-` branches can be created by the release team.

This does not affect any existing branches, which we can fade out over
time instead.
@wolfgangwalther wolfgangwalther requested a review from a team as a code owner June 19, 2025 15:54
@wolfgangwalther
Copy link
Contributor Author

The related branches have also been documented here: https://github.com/NixOS/nixpkgs/blob/master/ci/README.md#branch-classification. We marked "all other branches", which would be forbidden to be created by these branch protection rules here, as "deprecated".

@zimbatm
Copy link
Member

zimbatm commented Jun 25, 2025

Did you think how new branches could still be created once this PR is merged?

There might be some scenarios where maintainers need to create semi-long-lived branches, so they can be built on Hydra. Let's say a new Gnome release for example. When that happens, the maintainers need to know what process they need to use to get that branch created.

@wolfgangwalther
Copy link
Contributor Author

The idea is to use the wip- namespace for that - and anyone could create branches there.

Where would you suggest would this best be documented? In ci/README.md in the nixpkgs repo or somewhere else?

Copy link
Member

@infinisil infinisil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This sounds good to me, but can we can approval from another @NixOS/org owner?

"refs/heads/nixos-*",
"refs/heads/nixpkgs-*",
"refs/heads/release-*",
"refs/heads/revert-**",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be

Suggested change
"refs/heads/revert-**",
"refs/heads/revert-*",

Or is there no difference?

Copy link
Contributor Author

@wolfgangwalther wolfgangwalther Jul 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a difference: ** will include /. Aka when you have a branch called revert-123456-feat/stuff, revert-* will not match, but revert-** will.

Since the revert- branches are auto-created from the PR number and the head branch of the PR, which was provided by a regular contributor, this can use the / format.

I'm OK with not allowing these for wip- and backport- prefixes, but for the above reason we must support them for revert-.

Edit: This is a moment where I miss the ability to add comments to .json...

Copy link
Contributor Author

@wolfgangwalther wolfgangwalther Jul 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a difference: ** will include /. Aka when you have a branch called revert-123456-feat/stuff, revert-* will not match, but revert-** will.

That's what the docs tell me, at least: https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/managing-rulesets/creating-rulesets-for-a-repository#using-fnmatch-syntax

But it's apparently not that easy, because @philiptaron just hit this when trying to revert a r-ryantm. The branch is called auto-update/re2 - and is blocked by our new rule.

I reproduced this in my fork as well. Regular branches work well, but those with / don't.

After applying parent commit
@infinisil
Copy link
Member

Applied!

@infinisil infinisil merged commit ae48eeb into NixOS:main Jul 10, 2025
2 checks passed
@wolfgangwalther wolfgangwalther deleted the rulesets-nixpkgs-no-creation branch July 11, 2025 06:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants