branch-protection-bot
branch-protection-bot copied to clipboard
[Feature] Wildcard-Branch protection
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.
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:
- Add a configuration option to support specific branch-protection rules (so we can target our wildcard-rules)
- 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.
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?
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..
Sorry I meant disabling 'include administrators'
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.
Or putting in the README as a step example something like:
- name: "Temporarily disable 'include administrators' default branch protection"
uses: benjefferies/[email protected]
if: always()
with:
access-token: ${{ secrets.ACCESS_TOKEN }}
branch: ${{ github.event.repository.default_branch }}
which catch the attention straight away
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
Thanks for the suggestions @crazy-matt https://github.com/benjefferies/branch-protection-bot/pull/22