Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Getting close to a working prototype
- Loading branch information
1 parent
b0c62cc
commit b8f8818
Showing
3 changed files
with
43 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,11 +1,44 @@ | ||
| #!/usr/bin/env perl6 | ||
|
|
||
| use JSON::Fast; | ||
| use Unbitrot::Utils; | ||
|
|
||
| unit main multi MAIN( | ||
| unit sub MAIN( | ||
| ‘I know what I'm doing’, | ||
| $token, | ||
| IO() $blin-data = ‘data.json’, | ||
| IO() :$blin-data = ‘data.json’, | ||
| IO() :$template = ‘template.md’, | ||
| ); | ||
|
|
||
| my $data = from-json slurp $blin-data; | ||
|
|
||
| my @issues = get-issues; | ||
| my %modules = from-json slurp $blin-data; | ||
| my @issues = get-issues $token; | ||
| my $template-text = slurp $template; | ||
|
|
||
| for @issues -> $issue { | ||
| .<ticket> = $issue with %modules{$issue<title>}; | ||
| } | ||
|
|
||
| for %modules.keys.sort -> $name { | ||
| my $module = %modules{$name}; | ||
| my $ticket = $module<ticket>; | ||
| if $module<status> eq ‘OK’ { | ||
| if $ticket and $ticket<state> ne ‘closed’ { | ||
| note “Closing issue {$ticket<number>} for $name”; | ||
| # close-single-issue $ticket<url>, $token | ||
| } | ||
| } else { | ||
| if not $ticket or $ticket<state> eq ‘closed’ { | ||
| note “Creating new issue for $name”; | ||
|
|
||
| my $text = $template-text; | ||
| $text .= subst: ‘「MODULE」’, 42; | ||
| $text .= subst: ‘「MODULE-URL」’, 42; # https://modules.perl6.org/dist/$module | ||
| $text .= subst: ‘「OUTPUT」’, 42; | ||
| $text .= subst: ‘「PING-AUTHOR」’, 42; | ||
| $text .= subst: ‘「PREVIOUS-TICKET」’, 42; | ||
|
|
||
| # submit-issue $token, $text | ||
| } | ||
| } | ||
| } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters