| File: | cleanup-file.pl |
| Coverage: | 55.6% |
| line | stmt | bran | cond | sub | time | code |
|---|---|---|---|---|---|---|
| 1 | #!/usr/bin/env perl | |||||
| 2 | 1 1 1 | 1181 1 518 | use Cwd qw(abs_path); | |||
| 3 | 1 | 45648 | my $maybe_bad=abs_path($ENV{maybe_bad}); | |||
| 4 | 1 | 7 | my $workspace_path=abs_path($ENV{GITHUB_WORKSPACE}); | |||
| 5 | 1 | 7 | if ($maybe_bad !~ /^\Q$workspace_path\E/) { | |||
| 6 | 0 | 0 | print "::error ::Configuration files must live within $workspace_path...\n"; | |||
| 7 | 0 | 0 | print "::error ::Unfortunately, file $maybe_bad appears to reside elsewhere.\n"; | |||
| 8 | 0 | 0 | exit 3; | |||
| 9 | } | |||||
| 10 | 1 | 0 | if ($maybe_bad =~ m{/\.git/}i) { | |||
| 11 | 0 | 0 | print "::error ::Configuration files must not live within `.git/`...\n"; | |||
| 12 | 0 | 0 | print "::error ::Unfortunately, file $maybe_bad appears to.\n"; | |||
| 13 | 0 | 0 | exit 4; | |||
| 14 | } |