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

Small Archive Tweaks #54

Merged
merged 2 commits into from
May 26, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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