Merge pull request #1042 from DeterminateSystems/declarative-jobsets-no-jq

GitHubPulls: output sorted json without using jq
This commit is contained in:
Graham Christensen 2021-10-20 10:33:46 -04:00 committed by GitHub
commit d5282de131
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -53,11 +53,12 @@ sub fetchInput {
_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 $filename = "$tempdir/github-pulls.json";
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;
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");
chomp $storePath;
my $timestamp = time;