Smokedetector: Allow code admins to easily merge blacklist PRs

Created on 25 Apr 2017  Â·  3Comments  Â·  Source: Charcoal-SE/SmokeDetector

Allow code admins to reply to a “You don’t have code privileges” message to accept/reject the PR
source

The reply looks like this:

You don't have code privileges, but I've created a pull request for you.
source

All that’s needed is to POST to https://api.github.com/repos/Charcoal-SE/SmokeDetector/pulls/:id/merge. However, by setting the commit_message query param to Approved by <username> (<message permalink>), anyone can see who approved the blacklist later on.

To reject the PR, optionally POST to https://api.github.com/repos/Charcoal-SE/SmokeDetector/pulls/:id/reviews with body set to “Rejected by ,” event set to REQUEST_CHANGES and the Accept header set to application/vnd.github.black-cat-preview+json to create a review, then PATCH to https://api.github.com/repos/Charcoal-SE/SmokeDetector/pulls/:id with state set to closed.

blacklists completed feature request

Most helpful comment

@angussidney Mind you, a bunch of code admins don't have git rights so they can't merge PRs (like me).

So we get to the situation that if I want to blacklist something and someone without code privileges beats me to the punch, I can't accept their PR. I can either blacklist it myself, invalidating their PR (and I'll have to comment on it to prevent a double blacklisting) or wait until an admin comes along. Not great options either way.

All 3 comments

In the time that it takes to reply to the message, I can most likely open the PR and merge it. Is this really worth the dev time required to implement?

I've already started work on a userscript which allows you to toggle autopull on any given commit/PR, which would make the standard approach even faster.

@angussidney Mind you, a bunch of code admins don't have git rights so they can't merge PRs (like me).

So we get to the situation that if I want to blacklist something and someone without code privileges beats me to the punch, I can't accept their PR. I can either blacklist it myself, invalidating their PR (and I'll have to comment on it to prevent a double blacklisting) or wait until an admin comes along. Not great options either way.

This was implemented a while ago; code admins can simply type !!/approve in a comment on the PR, and metasmoke will automatically merge it (as long as only the blacklists were modified and the PR was made by Smokey).

Please note that you will need to be added to PullApprove for this to work. If you're already part of the Charcoal-SE organisation on Github (any team will do), you can simply make a PR to add your GitHub username to this file, or ask someone with push access to do it for you. If you're not already part of the Charcoal-SE organisation, then ping @ArtOfCode- and he can set you up.

A related !!/approve command for chat has been status-deferred. See #819.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

SulphurDioxide picture SulphurDioxide  Â·  9Comments

fortunate-man picture fortunate-man  Â·  3Comments

FelixSFD picture FelixSFD  Â·  3Comments

tripleee picture tripleee  Â·  7Comments

tripleee picture tripleee  Â·  4Comments