Applies labels to github issues

We look for labels in the format of "##name" in the comments of newly opened
issues and existing issues.

A label / list of labels in a comment will replace all existing labels.

Pull requests are automatically tagged "is: pull request". The comment when
opening a pull request is also checked for labels (but in practice, probably
not something that's going to be used that often)

Valid labels are:

* ##from: suggestions/support
* ##is: bug/feature
* ##effort: average/average/higher
* ##severity: minor/major/critical

Labels not on that list won't be applied.

Fixes dreamwidth/dw-free#701
Haha oops thanks. I'll fix that in a bit.





On Thu, Jun 19, 2014, at 04:23 AM, Sophira wrote:

  In cgi-bin/DW/Controller/Interface/Github.pm:
> +}
> +
> +sub _replace_labels {
> +    my ( $issue_num, $is_pull_request, @labels ) = @_;
> +    return unless @labels;
> +
> +    # automatically add labels (but only if we're modifying labels in the fir
st place)
> +    push @labels, ( $is_pull_request ? "type: pull request" : "type: issue" )
;
> +
> +    my $ua = LJ::get_useragent( role => 'github' );
> +    $ua->agent( $LJ::SITENAME );
> +
> +    my $auth = $LJ::GITHUB{api_token} . ':x-oauth-basic';
> +
> +    # replace all labels in the issue
> +    my $res = $ua->put( "https://${auth}\@api.github.com/repos/afuna/dw-free/
issues/$issue_num/labels",

  Was just looking through and it looks like you've still got your own
  fork's URL here!

  —

Reply to this email directly or [1]view it on GitHub.

References

1. https://github.com/dreamwidth/dw-nonfree/pull/58/files#r13963155