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

Repository settings guidelines: Apply rules also to branch creation #2178

Merged
merged 5 commits into from
Jul 16, 2024
Merged

Repository settings guidelines: Apply rules also to branch creation #2178

merged 5 commits into from
Jul 16, 2024

Conversation

arminru
Copy link
Member

@arminru arminru commented Jul 2, 2024

This setting enables the branch protection rule to not only cover PRs targeting an existing branch, but also the creation of new branches.

For the main branch, this doesn't make a difference as it will usually be there, but for the **/** pattern, as per

#### Branch protection rule: `**/**`
Same as for [`main`](#branch-protection-rule-main) above.
the rules for main are re-used.

Docs:
https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/managing-protected-branches/managing-a-branch-protection-rule

@jpkrohling
Copy link
Member

Wouldn't it prevent dependabot and similar tools from working? They push PRs from branches they create on the target repo, from what I remember.

@austinlparker
Copy link
Member

Wouldn't it prevent dependabot and similar tools from working? They push PRs from branches they create on the target repo, from what I remember.

If you're using dependabot you can make a branch protection rule for its branches specifically.

@jpkrohling
Copy link
Member

Sounds good. As long as we are not breaking current tools with this change, I'm fine with the change.

@arminru
Copy link
Member Author

arminru commented Jul 4, 2024

@jpkrohling exactly as @austinlparker said - the rules for Dependabot and Renovate overrule the main and the **/** catchall rule:

#### Branch protection rule: `dependabot/**/**`
Everything not mentioned is unchecked.
* Allow force pushes: :heavy_check_mark:
* `Everyone` (all users with push access)
* (so that dependabot can rebase its pull requests)
* Allow deletions: :heavy_check_mark:
* (so that branches can be deleted after merging)
**Note:** "Require a pull request before merging" and
"Require status checks to pass before merging" both need to be `unchecked` so that
these branches can be directly updated (without going through a pull request).
#### Branch protection rule: `renovate/**/**`
Same as for [`dependabot/**/**`](#branch-protection-rule-dependabot) above.
This branch protection rule is not set up automatically, but can be added for any
repositories that are using [Renovate](https://github.com/apps/renovate).

@danielgblanco
Copy link
Contributor

@arminru can you create an issue to apply this to all repos and link it here?

@arminru
Copy link
Member Author

arminru commented Jul 16, 2024

@danielgblanco Done! #2213

@arminru arminru merged commit a15bfc0 into open-telemetry:main Jul 16, 2024
4 checks passed
@arminru arminru deleted the repo-rules branch July 16, 2024 10:59
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.

5 participants