File tree Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Original file line number Diff line number Diff line change @@ -5,16 +5,16 @@ const unsupportedEvent = name => name !== "pull_request" && name !== "push" ? tr
5
5
const getBase = name => data => name === "pull_request" ? data . pull_request . base . sha : data . before ;
6
6
const getHead = name => data => name === "pull_request" ? data . pull_request . head . sha : data . after ;
7
7
const normalise = path => path . split ( "/" ) . filter ( item => item !== "" && item !== "." ) . join ( "/" ) ;
8
- const failed = massage => { throw message ; } ;
8
+ const toBoolean = value => value . toLowerCase ( ) == "true" ;
9
9
10
10
( async function ( ) {
11
11
try {
12
12
const path = core . getInput ( "path" ) ;
13
13
const token = core . getInput ( "token" ) ;
14
- const strict = core . getInput ( "strict" ) ;
15
14
const repo = github . context . repo . repo ;
16
15
const owner = github . context . repo . owner ;
17
16
const event_name = github . context . eventName ;
17
+ const strict = toBoolean ( core . getInput ( "strict" ) ) ;
18
18
const octokit = github . getOctokit ( token , { required : true } ) ;
19
19
20
20
if ( unsupportedEvent ( event_name ) ) throw `This event (${ event_name } ) is unsupported. Simple Diff only supports PUSH and PR events.` ;
@@ -39,9 +39,8 @@ const failed = massage => { throw message; };
39
39
return ;
40
40
}
41
41
42
- strict === true
43
- ? failed ( `None of the files in this commits diff tree match the provided file (${ path } ).` )
44
- : console . log ( `None of the files in this commits diff tree match the provided file (${ path } ).` ) ;
42
+ if ( strict === true ) throw `None of the files in this commits diff tree match the provided file (${ path } ).` ;
43
+ console . log ( `None of the files in this commits diff tree match the provided file (${ path } ).` ) ;
45
44
46
45
} catch ( error ) {
47
46
core . setFailed ( error ) ;
You can’t perform that action at this time.
0 commit comments