File Coverage

File:cleanup-file.pl
Coverage:100.0%

linestmtbrancondsubtimecode
1#!/usr/bin/env perl
2
3
3
3
2996
3
1344
use Cwd qw(abs_path);
3
3
120311
my $maybe_bad=abs_path($ENV{maybe_bad});
4
3
14
my $workspace_path=abs_path($ENV{GITHUB_WORKSPACE});
5
3
22
if ($maybe_bad !~ /^\Q$workspace_path\E/) {
6
1
8
    print "::error ::Configuration files must live within $workspace_path...\n";
7
1
1
    print "::error ::Unfortunately, file $maybe_bad appears to reside elsewhere.\n";
8
1
0
    exit 3;
9}
10
2
4
if ($maybe_bad =~ m{/\.git/}i) {
11
1
9
    print "::error ::Configuration files must not live within `.git/`...\n";
12
1
1
    print "::error ::Unfortunately, file $maybe_bad appears to.\n";
13
1
0
    exit 4;
14}