Comments (11)
@jwsloan you can take a stab at it yourself, and even host your own app for testing.
Basically, each top-level key in this plugins config (repository
, labels
, contributors,
team`) corresponds to a plugin file here: https://github.com/probot/settings/tree/master/lib/plugins
I believe that the github apps code just takes values corresponding to api endpoints in a really lightweight way, although you'll have to do your own research there. As I understand, anything in the API is scriptable via github apps framework.
So tl;dr, you'll want to create a new key for branches
and wire it up according to the endpoint where protected branches happen: https://developer.github.com/v3/repos/branches/
Good luck! Someone who's written more apps can prob tell you more :)
EDIT: keep us posted here if you take a run at it!
from app.
We have a similar thing to probot/settings
that support protected branches and the first enhancement was "branch protection templates". i.e. (I'm just taking OP's yaml for consistency)
protected_branches:
templates:
- pattern: release/*
required_status_checks:
include_admins: true # Enforce required status checks for repository administrators.
strict: true # Require branches to be up to date before merging.
contexts: [continuous-integration/jenkins]
required_pull_request_reviews: true # boolean or 'non-admin'
teams: [team1, team2]
users: [person1, person2]
You could then apply it to existing branches, or just respond to CreateEvent/branch
going forward.
from app.
Would it be awful to mirror the Update Branch Protection API docs?
It seems like I could just write a class with a sync()
function that turns this yaml into JSON, and passes it directly to the API call. Am I missing something?
branches:
master:
protection:
required_status_checks:
strict: true
contexts: []
enforce_admins: true
required_pull_request_reviews:
dismissal_restrictions:
users: []
teams: []
dismiss_stale_reviews: true
require_code_owner_reviews: true
restrictions:
users: []
teams: []
from app.
@jwsloan that's what I did 👍 #superlazy
from app.
required_pull_request_reviews: true # boolean or 'non-admin'
I'm not crazy about this syntax. This feature basically has an on/off toggle, and then on/off for also requiring admins (see api).
Here's an alternate option:
required_pull_request_reviews: true # on for everyone
required_pull_request_reviews: false # off for everyone
required_pull_request_reviews:
include_admins: false # on for all non-admins
from app.
The alternative strikes me as a little nicer, fwiw :)
from app.
If we could setup protected branches this way, I think this app would be fantastic. Any idea when this enhancement might occur? Or maybe some guidance as to how someone else might make the change and get an accepted PR?
from app.
@nnordrum that looks great, but I feel like I'm missing something. Is that something I can make use of? If so, how?
from app.
Would it be awful to mirror the Update Branch Protection API docs?
That would be ideal, IMHO.
from app.
Is this still relevant? If so, please comment with any updates or addition details.
from app.
i see a number of the more complex options for protected branches detailed out above, but my most common use case for simple repos is to simply mark it as protected so no one can accidentally force push. what might that simple configuration look like?
from app.
Related Issues (20)
- Add option to allow specified actors to bypass required pull requests HOT 3
- Support organization's settings for all repos
- [bug] labels donot work HOT 1
- Apply Changes to repository without beeing forced to change the settings.yml HOT 2
- Sharing actions and reusable workflows HOT 2
- Team remove should not fail if team could not be deleted
- Environments settings are not reflected. HOT 6
- Renaming a repository referenced in _extends breaks authorization
- Support variables in environments HOT 4
- feature: add repositories rules
- Feature: Enable/Disable Advanced Security
- Support for the auto-merge option HOT 3
- move away from prettier-standard
- Feature: Accessible Error Messages HOT 1
- App
- Token
- 58cfedc52f2c398817615caed4d6a79719c0271e
- Add support for adding Protected Tags HOT 1
- Allow .yaml
- Verify Publisher HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from app.