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

[Feature] Wildcard-Branch protection #7

Open
amacado opened this issue Mar 28, 2020 · 7 comments
Open

[Feature] Wildcard-Branch protection #7

amacado opened this issue Mar 28, 2020 · 7 comments

Comments

@amacado
Copy link

amacado commented Mar 28, 2020

At first let me thank you for this useful action! As I have set this up in our repository I encountered a problem which could lead into a feature request for this action.

We protect our branches based on wildcards, f.e. development/*which matches all branches starting with development/. When your branch-protection-bot action is executed it will create a new branch protection rule (based on the wildcard rules) and not updating our existing wildcard protection. When the action re-enables the 'include administrators' option it will only do it on the newly created branch protection rule.

image

This is not a real problem but enforces us to update all branch protection rules and not just one wildcard when we f.e. want to enforce a new status check.

I have two ideas about this:

  1. Add a configuration option to support specific branch-protection rules (so we can target our wildcard-rules)
  2. Add a configuration option which allows instead of toggling the state of 'include administrators' to remove the newly created branch protection rule

Would love to hear your ideas about it.

@benjefferies
Copy link
Owner

I'm happy to accept a PR that will automatically create branch protection rules as this is an issue when master branch doesn't have branch protection. The only requests I would have is:

  • Default branch pattern is set to master
  • Handles the case where the branch protection already exists
  • Backwards compatible

What advantage do you see in deleting branch protection over disabling?

@amacado
Copy link
Author

amacado commented Mar 28, 2020

What advantage do you see in deleting branch protection over disabling?

How do you disable a branch protection? I don't see an option for that..

@benjefferies
Copy link
Owner

Sorry I meant disabling 'include administrators'

@crazy-matt
Copy link
Contributor

Hi guys,
I wonder if you shouldn't put the default branch as being 'main'. As the new repos are now created with main as a standard on Github. But nothing important really.

@crazy-matt
Copy link
Contributor

Or putting in the README as a step example something like:

 - name: "Temporarily disable 'include administrators' default branch protection"
        uses: benjefferies/branch-protection-bot@1.0.5
        if: always()
        with:
          access-token: ${{ secrets.ACCESS_TOKEN }}
          branch: ${{ github.event.repository.default_branch }}

which catch the attention straight away

@crazy-matt
Copy link
Contributor

crazy-matt commented Sep 16, 2021

Otherwise, I just loved the idea of this action to handle a situation that Github does not want to handle at the moment probably for security implications. Tested it and it does the job like a charm! Thanks @benjefferies for that

@benjefferies
Copy link
Owner

Thanks for the suggestions @crazy-matt #22

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

No branches or pull requests

3 participants