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

Branch protection rules don't apply for non-existent branches #136

Open
allejo opened this issue Sep 3, 2019 · 8 comments
Open

Branch protection rules don't apply for non-existent branches #136

allejo opened this issue Sep 3, 2019 · 8 comments
Labels
pinned requires API changes It is currently not possible to configure this option through the API

Comments

@allejo
Copy link

allejo commented Sep 3, 2019

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: "?.?"
@allejo allejo changed the title Branch protection doesn' Branch protection rules don't apply for non-existent branches Sep 3, 2019
@stale
Copy link

stale bot commented Dec 3, 2019

Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?

@stale stale bot added the wontfix label Dec 3, 2019
@gundalow
Copy link

gundalow commented Dec 3, 2019

@allejo if you replace the null does it work? #150

@stale stale bot removed the wontfix label Dec 3, 2019
@scheuk
Copy link

scheuk commented Jan 27, 2020

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

@stale
Copy link

stale bot commented Apr 26, 2020

Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?

@stale stale bot added the wontfix label Apr 26, 2020
@gundalow
Copy link

Still relevant

@stale stale bot removed the wontfix label Apr 26, 2020
@travi travi added pinned requires API changes It is currently not possible to configure this option through the API labels Apr 27, 2020
@dhoppe
Copy link

dhoppe commented May 14, 2020

Any idea why the web interface of GitHub is able to create rules for non existent branches, but Probot does not?

@travi
Copy link
Member

travi commented May 14, 2020

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.

@mkrakowitzer
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pinned requires API changes It is currently not possible to configure this option through the API
Projects
None yet
Development

No branches or pull requests

6 participants