mirror of
https://github.com/vishapoberon/compiler.git
synced 2026-04-06 13:22:26 +00:00
Don't trigger autobuild when change only affects .md or .svg files.
This commit is contained in:
parent
89e2616c5b
commit
5c8b98dd05
1 changed files with 30 additions and 20 deletions
|
|
@ -21,29 +21,39 @@ sub writelog {
|
||||||
|
|
||||||
my $postdata = from_json(param('POSTDATA'));
|
my $postdata = from_json(param('POSTDATA'));
|
||||||
|
|
||||||
my $url = $postdata->{'repository'}->{'url'};
|
my $url = $postdata->{'repository'}->{'url'};
|
||||||
my $ref = $postdata->{'ref'};
|
my $ref = $postdata->{'ref'};
|
||||||
my $name = $postdata->{'head_commit'}->{'author'}->{'name'};
|
my $name = $postdata->{'head_commit'}->{'author'}->{'name'};
|
||||||
|
my $branch = $ref; $branch =~ s'^.*\/'';
|
||||||
|
my $repo = $url; $repo =~ s'^.*\/'';
|
||||||
|
my $modified = $postdata->{'head_commit'}->{'modified'};
|
||||||
|
|
||||||
my $branch = $ref; $branch =~ s'^.*\/'';
|
my $buildneeded = 0;
|
||||||
my $repo = $url; $repo =~ s'^.*\/'';
|
for my $file (@{$modified}) {
|
||||||
|
if ($file !~ m/\.(md|svg)$/i) {$buildneeded = 1;}
|
||||||
writelog "Post push github web hook for repository $repo, branch $branch, name $name.";
|
|
||||||
|
|
||||||
|
|
||||||
my $child = fork;
|
|
||||||
if (not defined $child) {die "Fork failed.";}
|
|
||||||
if ($child) {
|
|
||||||
writelog "Started buildall, pid = $child."; # parent process
|
|
||||||
} else {
|
|
||||||
close(STDIN); close(STDOUT); close(STDERR); # child process
|
|
||||||
unlink "buildall.pl";
|
|
||||||
sleep 5; # Leave time for the push to complete. (Yuk!)
|
|
||||||
system 'wget https://raw.githubusercontent.com/vishaps/voc/v2docs/src/tools/make/buildall.pl';
|
|
||||||
exec 'perl buildall.pl >/tmp/buildall.log';
|
|
||||||
exit;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($buildneeded) {
|
||||||
|
writelog "Post push github web hook for repository $repo, branch $branch, name $name. Build required.";
|
||||||
|
|
||||||
|
|
||||||
|
my $child = fork;
|
||||||
|
if (not defined $child) {die "Fork failed.";}
|
||||||
|
if ($child) {
|
||||||
|
writelog "Started buildall, pid = $child."; # parent process
|
||||||
|
} else {
|
||||||
|
close(STDIN); close(STDOUT); close(STDERR); # child process
|
||||||
|
unlink "buildall.pl";
|
||||||
|
sleep 5; # Leave time for the push to complete. (Yuk!)
|
||||||
|
system 'wget https://raw.githubusercontent.com/vishaps/voc/master/src/tools/make/buildall.pl';
|
||||||
|
exec 'perl buildall.pl >/tmp/buildall.log';
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
writelog "Post push github web hook for repository $repo, branch $branch, name $name. No build required.";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
print header(),
|
print header(),
|
||||||
start_html("Vishap Oberon github post push web hook."),
|
start_html("Vishap Oberon github post push web hook."),
|
||||||
p("Repository $repo, branch $branch, name $name."),
|
p("Repository $repo, branch $branch, name $name."),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue