File tree Expand file tree Collapse file tree 3 files changed +20
-1
lines changed
Expand file tree Collapse file tree 3 files changed +20
-1
lines changed Original file line number Diff line number Diff line change 4444| message | string | 'chore : autopublish ${date}' | Commit message. |
4545| branch | string | 'main' | Destination branch to push changes. |
4646| empty | boolean | false | Allow empty commit. |
47+ | amend | boolean | false | Determines if the commit should be amended. Needs to be used with `force` input to force push the amended commit. |
4748| force | boolean | false | Determines if force push is used. |
4849| tags | boolean | false | Determines if `--tags` is used. |
4950| directory | string | '.' | Directory to change to before pushing. |
Original file line number Diff line number Diff line change @@ -33,6 +33,10 @@ inputs:
3333 empty :
3434 description : ' Allow empty commit'
3535 required : false
36+ amend :
37+ description : ' Determines if the commit should be amended'
38+ required : false
39+ default : ' false'
3640 force :
3741 description : ' Determines if force push is used'
3842 required : false
Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ INPUT_COAUTHOR_EMAIL=${INPUT_COAUTHOR_EMAIL:-''}
99INPUT_COAUTHOR_NAME=${INPUT_COAUTHOR_NAME:- ' ' }
1010INPUT_MESSAGE=${INPUT_MESSAGE:- " chore: autopublish ${timestamp} " }
1111INPUT_BRANCH=${INPUT_BRANCH:- master}
12+ INPUT_AMEND=${INPUT_AMEND:- false}
1213INPUT_FORCE=${INPUT_FORCE:- false}
1314INPUT_TAGS=${INPUT_TAGS:- false}
1415INPUT_EMPTY=${INPUT_EMPTY:- false}
@@ -25,6 +26,10 @@ if ${INPUT_EMPTY}; then
2526 _EMPTY=' --allow-empty'
2627fi
2728
29+ if ${INPUT_AMEND} ; then
30+ _AMEND=' --amend --no-edit'
31+ fi
32+
2833if ${INPUT_FORCE} ; then
2934 _FORCE_OPTION=' --force'
3035fi
@@ -43,7 +48,16 @@ git config --local user.name "${INPUT_AUTHOR_NAME}"
4348
4449git add -A
4550
46- if [ -n " ${INPUT_COAUTHOR_EMAIL} " ] && [ -n " ${INPUT_COAUTHOR_NAME} " ]; then
51+ if ${INPUT_AMEND} ; then
52+ if [ -n " ${INPUT_COAUTHOR_EMAIL} " ] && [ -n " ${INPUT_COAUTHOR_NAME} " ]; then
53+ git commit ${_AMEND} -m " ${INPUT_MESSAGE}
54+
55+ Co-authored-by: ${INPUT_COAUTHOR_NAME} <${INPUT_COAUTHOR_EMAIL} >" || exit 0
56+ else
57+ git commit ${_AMEND} -m " ${INPUT_MESSAGE} " $_EMPTY || exit 0
58+ fi
59+
60+ elif [ -n " ${INPUT_COAUTHOR_EMAIL} " ] && [ -n " ${INPUT_COAUTHOR_NAME} " ]; then
4761 git commit -m " ${INPUT_MESSAGE}
4862
4963
You can’t perform that action at this time.
0 commit comments