File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -13,12 +13,18 @@ function checkInputs() {
13
13
const eventPath = process . env . GITHUB_EVENT_PATH
14
14
if ( eventPath ) {
15
15
const { author } = require ( eventPath ) . head_commit
16
- if ( ! process . env . INPUT_AUTHOR_NAME ) process . env . INPUT_AUTHOR_NAME = author . name
17
- if ( ! process . env . INPUT_AUTHOR_EMAIL ) process . env . INPUT_AUTHOR_EMAIL = author . email
16
+ setDefault ( 'author_name' , author . name )
17
+ setDefault ( 'author_email' , author . email )
18
18
} else {
19
19
core . warning ( 'No event path available, unable to fetch author info.' )
20
- if ( ! process . env . INPUT_AUTHOR_NAME ) process . env . INPUT_AUTHOR_NAME = 'Add & Commit Action'
21
- if ( ! process . env . INPUT_AUTHOR_EMAIL ) process . env . INPUT_AUTHOR_EMAIL = '[email protected] '
20
+ setDefault ( 'author_name' , 'Add & Commit Action' )
21
+ setDefault ( 'author_email' , '[email protected] ' )
22
22
}
23
+ core . info ( `Using '${ core . getInput ( 'author_name' ) } <${ core . getInput ( 'author_email' ) } >' as author.` )
23
24
core . info ( `Using '${ process . env . INPUT_AUTHOR_NAME } <${ process . env . INPUT_AUTHOR_EMAIL } >' as author.` )
24
25
}
26
+
27
+ function setDefault ( input : string , value : string ) {
28
+ const key = 'INPUT_' + input . toUpperCase ( )
29
+ if ( ! process . env [ key ] ) process . env [ key ] = value
30
+ }
You can’t perform that action at this time.
0 commit comments