File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ import ignore from 'ignore'
5
5
export class Exclude {
6
6
constructor ( ) {
7
7
this . path = core . getInput ( 'exclude_file' )
8
+ this . required = core . getBooleanInput ( 'exclude_file_required' )
8
9
this . gitTrackedOnly = core . getBooleanInput ( 'use_gitignore' )
9
10
10
11
// initialize the exclude array
@@ -13,8 +14,17 @@ export class Exclude {
13
14
// read the exclude file if it was used
14
15
if ( this . path && this . path !== '' ) {
15
16
core . debug ( `loading exclude_file: ${ this . path } ` )
16
- this . ignore . add ( readFileSync ( this . path , 'utf8' ) . toString ( ) )
17
- core . debug ( `loaded custom exclude patterns` )
17
+ try {
18
+ this . ignore . add ( readFileSync ( this . path , 'utf8' ) . toString ( ) )
19
+ core . debug ( `loaded custom exclude patterns` )
20
+ } catch ( error ) {
21
+ if ( this . required === true ) {
22
+ core . setFailed ( `error reading exclude_file: ${ this . path } ` )
23
+ return new Error ( `error: ${ error } ` )
24
+ }
25
+
26
+ core . info ( `exclude_file was not found, but it is not required - OK` )
27
+ }
18
28
}
19
29
20
30
// if gitTrackOnly is true, add the git exclude patterns from the .gitignore file if it exists
You can’t perform that action at this time.
0 commit comments