Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fetch some metadata from modules.perl6.org
  • Loading branch information
AlexDaniel committed Feb 8, 2019
1 parent 1482597 commit 0e2feb4
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
6 changes: 4 additions & 2 deletions bin/update-issues.p6
Expand Up @@ -14,6 +14,8 @@ unit sub MAIN(
my %modules = from-json slurp $blin-data;
my @issues = get-issues :$token;
my $template-text = slurp $template;
my $module-metadata = fetch https://modules.perl6.org/search.json;


for @issues -> $issue {
.<ticket> = $issue with %modules{$issue<title>};
Expand All @@ -38,9 +40,9 @@ for %modules.keys.sort -> $name {
my $previous-ticket = $ticket ?? Preivous ticket: # ~ $ticket<number> !! ;

$body .= subst: 「MODULE」, $name;
$body .= subst: 「MODULE-URL」, https://modules.perl6.org/dist/$module;
$body .= subst: 「MODULE-URL」, https://modules.perl6.org/dist/$name;
$body .= subst: 「BLIN-STATUS」, $module<status>;
$body .= subst: 「OUTPUT」, $module<output>;
$body .= subst: 「OUTPUT」, $module<output> || No output;
$body .= subst: 「PING-AUTHOR」, $ping-author;
$body .= subst: 「PREVIOUS-TICKET」, $previous-ticket;

Expand Down
18 changes: 14 additions & 4 deletions lib/Unbitrot/Utils.pm6
Expand Up @@ -4,14 +4,24 @@ unit module Unbitrot::Utils;

use Cro::HTTP::Client;

my $repo = perl6/ecosystem-unbitrot;
constant \issues-url = https://api.github.com/repos/$repo/issues?per_page=60&direction=asc&state=all;
constant \submit-url = https://api.github.com/repos/$repo/issues;
constant repo = perl6/ecosystem-unbitrot;
constant \issues-url = https://api.github.com/repos/{repo}/issues?per_page=60&direction=asc&state=all;
constant \submit-url = https://api.github.com/repos/{repo}/issues;

#| Fetches a url
sub fetch($url) is export {
my $resp = await Cro::HTTP::Client.get: $url,
headers => [
User-Agent => perl6 ecosystem unbitrot,
],
;
return await $resp.body
}

#| Returns all issues from the repo
sub get-issues(:$token, :$url = issues-url) is export {
my @issues;
my $cur-url = url;
my $cur-url = $url;
loop {
note $cur-url;
my $resp = await Cro::HTTP::Client.get: $cur-url,
Expand Down

0 comments on commit 0e2feb4

Please sign in to comment.