File tree 3 files changed +29
-3
lines changed
3 files changed +29
-3
lines changed Original file line number Diff line number Diff line change 11#! /bin/bash
22if [ " $INITIALIZED " != defined ]; then
3+ if [ " $RUNNER_OS " = " Windows" ]; then
4+ echo " ::error ::Windows isn't currently supported"
5+ exit 5
6+ fi
7+
38 now () {
49 date +' %s%N'
510 }
Original file line number Diff line number Diff line change 1616
1717# skip files that don't exist (including dangling symlinks)
1818if (scalar @ARGV ) {
19- @ARGV = grep {-r || $_ eq ' - ' } @ARGV ;
19+ @ARGV = grep {! -l && -f && -r } @ARGV ;
2020 unless (scalar @ARGV ) {
21- print STDERR " None of the provided files are readable\n " ;
21+ print STDERR " ::warning ::Was not provided any regular readable files \n " ;
2222 exit 0;
2323 }
2424}
Original file line number Diff line number Diff line change @@ -373,7 +373,28 @@ check_dictionary() {
373373}
374374
375375cleanup_file () {
376- maybe_bad=" $1 "
376+ export maybe_bad=" $1 "
377+
378+ result=0
379+ perl -e '
380+ use Cwd qw(abs_path);
381+ my $maybe_bad=abs_path($ENV{maybe_bad});
382+ my $workspace_path=abs_path($ENV{GITHUB_WORKSPACE});
383+ if ($maybe_bad !~ /^\Q$workspace_path\E/) {
384+ print "::error ::Configuration files must live within $workspace_path...\n";
385+ print "::error ::Unfortunately, file $maybe_bad appears to reside elsewhere.\n";
386+ exit 3;
387+ }
388+ if ($maybe_bad =~ m{/\.git/}i) {
389+ print "::error ::Configuration files must not live within `.git/`...\n";
390+ print "::error ::Unfortunately, file $maybe_bad appears to.\n";
391+ exit 4;
392+ }
393+ ' || result=$?
394+ if [ $result -gt 0 ]; then
395+ quit $result
396+ fi
397+
377398 type=" $2 "
378399 case " $type " in
379400 patterns|excludes|only)
You can’t perform that action at this time.
0 commit comments