-
Notifications
You must be signed in to change notification settings - Fork 182
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
Protected branches plugin #76
Protected branches plugin #76
Conversation
@bkeepers I didn't actually test this manually. I couldn't figure out how to get everything setup correctly. My creds were failing. But I figured I'd go ahead and get this submitted anyway. |
13e134b
to
a811c02
Compare
@bkeepers I have successfully tested this in a custom app. Any idea when you can take a look? |
a811c02
to
9b96faf
Compare
9b96faf
to
554fcaa
Compare
Is your custom app still live? I can do a review, but my JS chops are such that I'd feel best just using it for a week on a non-critical project :) |
@patcon hopefully this works... I just made it public. https://github.com/apps/probotsettingsprotectedbranches
|
Maybe there's room for a larger discussion on whether we could create two apps (prod and staging), and have a pipeline that deploys to prod on Happy to open another issue if that sounds plausible |
@jwsloan Thanks! 🎉 Playing with it here: https://github.com/patcon/sample-civictech-app (I'll prob fully exercise it tomorrow -- and it will also help me create a best-practice project starter template for civictech projects for the weekly hacknights I co-organize! so thanks so much!) |
README.md
Outdated
@@ -88,6 +88,34 @@ teams: | |||
permission: admin | |||
- name: docs | |||
permission: push | |||
|
|||
branches: | |||
- name: 'master' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
totes minor, but quoted strings aren't used anywhere else in config :)
README.md
Outdated
- name: 'master' | ||
# https://developer.github.com/v3/repos/branches/#update-branch-protection | ||
# Leaving this empty will disable branch protection for this branch. | ||
protection: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We certainly can. That makes a lot of sense. I was ordering it based on the API docs. But basing it on what people are most likely to be familiar with is the right call.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great so far! I'll pull it down soon and try it out.
What happens if I have protected branches and I remove the protection
key from the config? I'm assuming it stays configured? Is that the right behavior, or do you thin people would expect to see it removed?
Thanks for taking a look, @bkeepers. Currently removing the key means you no longer want to manage Protected Branches via this file. It will no longer make any changes. If you leave the |
Great point @bkeepers. I like @jwsloan's approach, that removing the key completely should leave protection as-is. Should we treat |
The build is failing✨ Good work on this PR so far! ✨ Unfortunately, the Travis CI build is failing as of 3708fbb. Here's the output:
|
3708fbb
to
d8ac45b
Compare
d8ac45b
to
5c71d19
Compare
@patcon I went ahead and implemented that. What do you think? |
Yep, I've used it! It's pretty rad. One thought is that the config is pretty complex and nested, and it might make sense for it to be more forgiving, since probot fails silently. I know you already extended (That might be a larger convo, so happy to defer this into a different issue, as I think it works fine as-if if the person configuring is careful :) |
Thanks for the feedback, @patcon! |
@patcon, I've pushed a commit adding tests for |
Hm. Odd. This was the commit, before which seemed to be was silently failing? I assume |
@patcon, sorry. I thought we were just discussing the top-level |
@patcon According to the API documentation, it looks like it is not valid to send It seems like an answer is to not have probot fail silently. Is there something we can do about that? It would definitely not be good for someone to think they've successfully protected a branch, but not had it work. |
@bkeepers the issue this came from just got marked stale. Do you think we could get it merged soon? Thanks! |
replying here since it has to do with code here :) My quick impression is that this would work. Perhaps worth having a larger comment code block giving some simple examples though -- if @jwsloan confirms, perhaps @travi you could suggest what would have helped you have clarity on how it works 🎉
|
sorry for the delayed response. somehow i had overlooked that this PR existed for the issue that I commented on. looks like there is a fair amount of info included here that I just hadn't found. mainly just wanted to make sure that the simple cases had been considered, and it sounds like they have. I'll be able to better confirm once this gets merged. my simples use cases are usually to enable "Protect this branch" to prevent force pushes over |
@bkeepers I'd like to also see this PR merged. Could we get a yes/no either way? |
Mr. @bkeepers, any chance we can move forward with this? |
Thanks @jwsloan and everyone else for your contributions here! Sorry for the delay in merging the changes, but thanks for your patience. This is available in production. Let me know if you see any issues or have any feedback. |
unfortunately, i'm not seeing this setting take effect. i initially tried just setting what i hoped would be the minimum. when that didn't work, i paid more attention to the "Required" properties. since that didn't enable protection for the branch either, i tried enabling one of the rules i didnt need, just to see if more was necessary, but still had no luck. am i missing something obvious? also, just a side note, but the new required properties somewhat conflict with the note under
I realize that they are only required if the higher-level settings are provided, but some clarification might be valuable there. |
@travi Since it is live now, I'll give it a shot myself. It could be that the Protected Branches API has changed since I submitted the PR, and I didn't do a good job of keeping track of that. |
@travi would you put in an issue with the settings you're using? |
I can add more detail tonight, but just in my phone for now. The links above show the variations I've tried |
opened a separate issue for what i mentioned above: #87 |
Fixes #3 .