app: Branch protection not being applied

None of the repos where I have branch protection configured gets the settings applied.

I did two different tests without success.

  1. new repo without any rule, rules are not created
  2. existing repo with rule for master, settings are not applied

Initially, I thought that this could be related to #136. That’s why I did test num 2.

Test were done on this repo: https://github.com/renatocaval/oh-my-git/ https://github.com/renatocaval/oh-my-git/blob/master/.github/settings.yml#L13-L23

About this issue

  • Original URL
  • State: open
  • Created 5 years ago
  • Reactions: 3
  • Comments: 19 (10 by maintainers)

Commits related to this issue

Most upvoted comments

I can’t get this to work either. I’d love some visibility of what’s happening when it tries to apply my yaml!

You are right. It works if all top-level settings are included.

Thanks for the tip.

That’s my current one:

branches:
  - name: master
    # https://developer.github.com/v3/repos/branches/#update-branch-protection
    # Branch Protection settings. Set to null to disable
    protection:
      # Required. Require at least one approving review on a pull request, before merging. Set to null to disable.
      required_pull_request_reviews:
        # The number of approvals required. (1-6)
        required_approving_review_count: 1
        # Dismiss approved reviews automatically when a new commit is pushed.
        dismiss_stale_reviews: true
      required_status_checks: null
      restrictions: null
      enforce_admins: null

I won’t work if I set then to false like in:

branches:
  - name: master
    # https://developer.github.com/v3/repos/branches/#update-branch-protection
    # Branch Protection settings. Set to null to disable
    protection:
      # Required. Require at least one approving review on a pull request, before merging. Set to null to disable.
      required_pull_request_reviews:
        # The number of approvals required. (1-6)
        required_approving_review_count: 1
        # Dismiss approved reviews automatically when a new commit is pushed.
        dismiss_stale_reviews: true
      required_status_checks: false
      restrictions: false
      enforce_admins: false

we should probably hide these details if true, but it looks like i had to set some properties that i wasn’t trying to configure to null in order to get my config to apply.

could you try some variations of that to see if gets you working? if that does end up working, i would be interested in the combination that worked as well as those that didnt so that we can try to improve configuring these.