forked from lix-project/hydra
GitHubPulls: output sorted json without using jq
This commit is contained in:
parent
2ee584e7ae
commit
3c38629fad
|
@ -53,11 +53,12 @@ sub fetchInput {
|
||||||
_iterate("https://api.github.com/repos/$owner/$repo/pulls?per_page=100", $auth, \%pulls, $ua);
|
_iterate("https://api.github.com/repos/$owner/$repo/pulls?per_page=100", $auth, \%pulls, $ua);
|
||||||
my $tempdir = File::Temp->newdir("github-pulls" . "XXXXX", TMPDIR => 1);
|
my $tempdir = File::Temp->newdir("github-pulls" . "XXXXX", TMPDIR => 1);
|
||||||
my $filename = "$tempdir/github-pulls.json";
|
my $filename = "$tempdir/github-pulls.json";
|
||||||
|
|
||||||
open(my $fh, ">", $filename) or die "Cannot open $filename for writing: $!";
|
open(my $fh, ">", $filename) or die "Cannot open $filename for writing: $!";
|
||||||
print $fh encode_json \%pulls;
|
print $fh JSON->new->utf8->canonical->encode(\%pulls);
|
||||||
close $fh;
|
close $fh;
|
||||||
system("jq -S . < $filename > $tempdir/github-pulls-sorted.json");
|
|
||||||
my $storePath = trim(`nix-store --add "$tempdir/github-pulls-sorted.json"`
|
my $storePath = trim(`nix-store --add "$filename"`
|
||||||
or die "cannot copy path $filename to the Nix store.\n");
|
or die "cannot copy path $filename to the Nix store.\n");
|
||||||
chomp $storePath;
|
chomp $storePath;
|
||||||
my $timestamp = time;
|
my $timestamp = time;
|
||||||
|
|
Loading…
Reference in a new issue