app
app copied to clipboard
Branch protection rules don't apply for non-existent branches
Given the following protection rules, a new rule will not be created targeting ?.?
branches if there's no branch matching that pattern. This also happened when I tried creating a rule for a develop
branch when there was no develop
branch in existence. Whereas with GitHub, you can create rules without having those branches existing.
branches:
- &master_branch_definition
name: master
protection:
required_pull_request_reviews:
required_approving_review_count: 1
dismiss_stale_reviews: false
require_code_owner_reviews: true
dismissal_restrictions: {}
required_status_checks: null
enforce_admins: true
restrictions: null
- <<: *master_branch_definition
name: "?.?"
Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?
@allejo if you replace the null
does it work? https://github.com/probot/settings/issues/150
I am also experiencing a similar issue, I have a settings.yml file that defines both master
and deploy/*
branches. And it's applying the settings fine to master, but not creating the rule for deploy/*
pattern.
I tried without any deploy/*
branch and I tried with a deploy/prod
branch and the probot-settings never created the rule.
repository:
name: reponame
branches:
- name: master
protection:
required_pull_request_reviews:
required_approving_review_count: 1
dismiss_stale_reviews: true
require_code_owner_reviews: true
required_status_checks: null
enforce_admins: true
restrictions: null
- name: "deploy/*"
protection:
required_pull_request_reviews:
required_approving_review_count: 1
dismiss_stale_reviews: null
require_code_owner_reviews: true
required_status_checks: null
enforce_admins: true
restrictions: null
Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?
Still relevant
Any idea why the web interface of GitHub is able to create rules for non existent branches, but Probot does not?
unfortunately, there are many areas where probot/settings is limited in how well it can match the capabilities of the web ui because of limitations of the api. i haven't had a chance to fully investigate this case, but this comment in a related issue, explains the problem as well as i've had a chance to understand it so far.
if you have a chance to investigate further before i do, i'd be happy to discuss any options you find. assuming it is still blocked by those limitations, the best option i can suggest is to reach out to github support and request that the functionality be added to the api. if you get a useful response, please update this issue with details.
Crossposting this for completeness, I don't believe this is an API constraint, I tested this now and the API supports added branches that do not exist.
mutation MyMutation {
__typename
createBranchProtectionRule(input: {repositoryId: "XXXXXXXXXXXXXXXXXX", pattern: "foobar*", restrictsPushes: false}) {
clientMutationId
}
}
This is the same for ##227