From cd79d0914c64b6cdf590c968656e420873b36f13 Mon Sep 17 00:00:00 2001 From: Graham Ollis Date: Tue, 30 Apr 2019 11:03:23 -0400 Subject: [PATCH] optionally get GitHub PAT from environment var --- lib/Alien/Build/Plugin/Download/GitHub.pm | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/lib/Alien/Build/Plugin/Download/GitHub.pm b/lib/Alien/Build/Plugin/Download/GitHub.pm index a6fde02..175fa24 100644 --- a/lib/Alien/Build/Plugin/Download/GitHub.pm +++ b/lib/Alien/Build/Plugin/Download/GitHub.pm @@ -87,7 +87,18 @@ sub init croak("Don't set set a start_url with the Download::GitHub plugin"); } - $meta->prop->{start_url} ||= "https://api.github.com/repos/@{[ $self->github_user ]}/@{[ $self->github_repo ]}/releases"; + my $start_url = join '/', + 'https://api.github.com/repos', + $self->github_user, + $self->github_repo, + 'releases'; + + if($ENV{GITHUB_TOKEN}) + { + $start_url .= "?access_token=$ENV{GITHUB_PAT}"; + } + + $meta->prop->{start_url} ||= $start_url; $meta->apply_plugin('Download', prefer => $self->prefer,