| File: | cleanup-file.pl |
| Coverage: | 100.0% |
| line | stmt | bran | cond | sub | time | code |
|---|---|---|---|---|---|---|
| 1 | #!/usr/bin/env perl | |||||
| 2 | 3 3 3 | 3643 4 1577 | use Cwd qw(abs_path); | |||
| 3 | 3 | 137099 | my $maybe_bad=abs_path($ENV{maybe_bad}); | |||
| 4 | 3 | 22 | my $workspace_path=abs_path($ENV{GITHUB_WORKSPACE}); | |||
| 5 | 3 | 26 | if ($maybe_bad !~ /^\Q$workspace_path\E/) { | |||
| 6 | 1 | 5 | 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 | 3 | if ($maybe_bad =~ m{/\.git/}i) { | |||
| 11 | 1 | 4 | 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 | } |