Skip to content
This repository has been archived by the owner on Apr 13, 2021. It is now read-only.

Commit

Permalink
Merge pull request #54 from techman83/master
Browse files Browse the repository at this point in the history
Small Archive Tweaks
  • Loading branch information
techman83 committed May 26, 2016
2 parents f3bb17f + e19cc39 commit 30b70e9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
1 change: 1 addition & 0 deletions bin/mirror-ckan
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ sub yesterday {
$mirror->upload_ckan($file);
};
}
sleep 1; # We're going to be checking 100s, lets not overwhelm the API
}

exit 0;
Expand Down
12 changes: 11 additions & 1 deletion lib/App/KSP_CKAN/WebHooks.pm
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,25 @@ post '/gh/:task' => sub {
}

my @commits;
my $sender;
my $json;
try {
@commits = @{from_json(request->body)->{commits}};
$json = from_json(request->body);
@commits = @{$json->{commits}};
$sender = $json->{sender}{login};
};

if ( $#commits == -1 && $task ne "release" ) {
info("No commits received");
return { "message" => "No add/remove commits received" };
}

if ( defined $sender && $sender eq 'kspckan-crawler' ) {
info("Commits sent by crawler, skipping on demand mirror");
status(204);
return;
}

if ( $task eq "inflate" ) {
inflate_github(commits => \@commits);
} elsif ( $task eq "mirror" ) {
Expand Down

0 comments on commit 30b70e9

Please sign in to comment.