Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Adds state-opening routines
  • Loading branch information
JJ committed Feb 8, 2019
1 parent eb2b08c commit 8918c81
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
6 changes: 3 additions & 3 deletions lib/Utils.pm6
Expand Up @@ -47,12 +47,12 @@ sub issue-per-module( %tickets, @modules --> Hash ) is export {
}

#| Edit issue
sub open-single-issue(:$url, :$token) {
sub open-single-issue($url, $token) is export {
patch( :$url, :$token, body => { state => 'open' } );
}

sub close-single-issue(:$url, :$token) {
patch( :$url, :$token, body => { state => 'close' } ),
sub close-single-issue($url, $token) is export {
patch( :$url, :$token, body => { state => 'closed' } ),
}

#| patch with cro
Expand Down
12 changes: 10 additions & 2 deletions t/1.t6
Expand Up @@ -12,12 +12,20 @@ my @not-ok-modules = modules-not-ok( $file );
ok @not-ok-modules, "Some modules are not OK";
my %tickets;
if %*ENV{'GH_TOKEN'} {
%tickets = get-issues( %*ENV{'GH_TOKEN'} );
my $token = %*ENV{'GH_TOKEN'};
%tickets = get-issues( $token );
ok %tickets, "Downloads tickets";
cmp-ok %tickets.elems, ">", 1, "There are tickets";
my %mapping = issue-per-module( %tickets, @not-ok-modules );
ok %mapping, "Mapping done";
dd %mapping;
for %tickets.keys -> $k {
say %tickets{$k}<state>;
}
my @closed-issues = %tickets.keys.grep( { %tickets{$_}<state> eq "closed"} );
ok @closed-issues, "Some issues are closed" or skip "No closed issues", 1;
my $resp = open-single-issue( @closed-issues[0], $token );
ok $resp, "Single issue has been opened";
dd $resp;
} else {
skip "No token for issues",1;
}
Expand Down

0 comments on commit 8918c81

Please sign in to comment.