File tree Expand file tree Collapse file tree 3 files changed +17
-4
lines changed Expand file tree Collapse file tree 3 files changed +17
-4
lines changed Original file line number Diff line number Diff line change 5
5
author_name :
6
6
description : The name of the user that will be displayed as the author of the commit
7
7
required : false
8
- default : Add & Commit GitHub Action
9
8
author_email :
10
9
description : The email of the user that will be displayed as the author of the commit
11
10
required : false
12
-
13
11
force :
14
12
description : Whether to use the force option on git add, in order to bypass eventual gitignores
15
13
required : false
Original file line number Diff line number Diff line change @@ -14,8 +14,8 @@ git_setup() {
14
14
EOF
15
15
chmod 600 $HOME /.netrc
16
16
17
- git config --global user.email
" [email protected] "
18
- git config --global user.name " Add & Commit GitHub Action "
17
+ git config --global user.email " $INPUT_AUTHOR_EMAIL "
18
+ git config --global user.name " $INPUT_AUTHOR_NAME "
19
19
}
20
20
21
21
add () {
Original file line number Diff line number Diff line change @@ -3,7 +3,22 @@ import * as shell from 'shelljs'
3
3
import * as path from 'path'
4
4
5
5
try {
6
+ checkInputs ( )
6
7
shell . exec ( path . join ( __dirname , '../src/entrypoint.sh' ) )
7
8
} catch ( e ) {
8
9
core . setFailed ( e )
9
10
}
11
+
12
+ function checkInputs ( ) {
13
+ const eventPath = process . env . GITHUB_EVENT_PATH
14
+ if ( eventPath ) {
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
18
+ } else {
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] '
22
+ }
23
+ core . info ( `Using '${ process . env . INPUT_AUTHOR_NAME } <${ process . env . INPUT_AUTHOR_EMAIL } >' as author.` )
24
+ }
You can’t perform that action at this time.
0 commit comments