From 3d044d2ec20ac765d46d349a90b59d0589f44c42 Mon Sep 17 00:00:00 2001 From: Shea Levy Date: Wed, 24 May 2017 08:53:29 -0400 Subject: [PATCH] Github status API: Pull authorization from github_authorization by default --- src/lib/Hydra/Plugin/GithubStatus.pm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/lib/Hydra/Plugin/GithubStatus.pm b/src/lib/Hydra/Plugin/GithubStatus.pm index 7677cbd8..136c7100 100644 --- a/src/lib/Hydra/Plugin/GithubStatus.pm +++ b/src/lib/Hydra/Plugin/GithubStatus.pm @@ -54,10 +54,12 @@ sub common { next if exists $seen{$input}->{$key}; $seen{$input}->{$key} = 1; $uri =~ m![:/]([^/]+)/([^/]+?)(?:.git)?$!; - my $req = HTTP::Request->new('POST', "https://api.github.com/repos/$1/$2/statuses/$rev"); + my $owner = $1; + my $repo = $2; + my $req = HTTP::Request->new('POST', "https://api.github.com/repos/$owner/$repo/statuses/$rev"); $req->header('Content-Type' => 'application/json'); $req->header('Accept' => 'application/vnd.github.v3+json'); - $req->header('Authorization' => $conf->{authorization}); + $req->header('Authorization' => ($self->{config}->{github_authorization}->{$owner} // $conf->{authorization})); $req->content($body); my $res = $ua->request($req); print STDERR $res->status_line, ": ", $res->decoded_content, "\n" unless $res->is_success;