@@ -32,6 +32,7 @@ setup() {
3232 export INPUT_COMMIT_USER_NAME=" Test Suite"
3333 export INPUT_COMMIT_USER_EMAIL=" test@github.com"
3434 export INPUT_COMMIT_AUTHOR=" Test Suite <test@users.noreply.github.com>"
35+ export INPUT_TAG=" "
3536 export INPUT_TAGGING_MESSAGE=" "
3637 export INPUT_PUSH_OPTIONS=" "
3738 export INPUT_SKIP_DIRTY_CHECK=false
@@ -123,7 +124,7 @@ cat_github_output() {
123124 assert_line " INPUT_FILE_PATTERN: ."
124125 assert_line " INPUT_COMMIT_OPTIONS: "
125126 assert_line " ::debug::Apply commit options "
126- assert_line " INPUT_TAGGING_MESSAGE : "
127+ assert_line " INPUT_TAG : "
127128 assert_line " No tagging message supplied. No tag will be added."
128129 assert_line " INPUT_PUSH_OPTIONS: "
129130 assert_line " ::debug::Apply push options "
@@ -146,7 +147,7 @@ cat_github_output() {
146147 assert_line " INPUT_FILE_PATTERN: ."
147148 assert_line " INPUT_COMMIT_OPTIONS: "
148149 assert_line " ::debug::Apply commit options "
149- assert_line " INPUT_TAGGING_MESSAGE : "
150+ assert_line " INPUT_TAG : "
150151 assert_line " No tagging message supplied. No tag will be added."
151152 assert_line " INPUT_PUSH_OPTIONS: "
152153 assert_line " ::debug::Apply push options "
@@ -293,21 +294,24 @@ cat_github_output() {
293294}
294295
295296@test " It creates a tag with the commit" {
296- INPUT_TAGGING_MESSAGE=" v1.0.0"
297+ INPUT_TAG=" v1.0.0"
298+ INPUT_TAGGING_MESSAGE=" MyProduct v1.0.0"
297299
298300 touch " ${FAKE_LOCAL_REPOSITORY} " /new-file-{1,2,3}.txt
299301
300302 run git_auto_commit
301303
302304 assert_success
303305
304- assert_line " INPUT_TAGGING_MESSAGE: v1.0.0"
305- assert_line " ::debug::Create tag v1.0.0"
306+ assert_line " INPUT_TAG: v1.0.0"
307+ assert_line " INPUT_TAGGING_MESSAGE: MyProduct v1.0.0"
308+
309+ assert_line " ::debug::Create tag v1.0.0: MyProduct v1.0.0"
306310 assert_line " ::debug::Push commit to remote branch ${FAKE_DEFAULT_BRANCH} "
307311
308312 # Assert a tag v1.0.0 has been created
309- run git tag
310- assert_output v1.0.0
313+ run git tag -n
314+ assert_output ' v1.0.0 MyProduct v1.0.0 '
311315
312316 run git ls-remote --tags --refs
313317 assert_output --partial refs/tags/v1.0.0
@@ -388,18 +392,20 @@ cat_github_output() {
388392 assert_equal $current_sha $remote_sha
389393}
390394
391- @test " It uses existing branch when INPUT_BRANCH is empty and INPUT_TAGGING_MESSAGE is set" {
395+ @test " It uses existing branch when INPUT_BRANCH is empty and INPUT_TAG is set" {
392396 INPUT_BRANCH=" "
393- INPUT_TAGGING_MESSAGE=" v2.0.0"
397+ INPUT_TAG=" v2.0.0"
398+ INPUT_TAGGING_MESSAGE=" MyProduct v2.0.0"
399+
394400
395401 touch " ${FAKE_LOCAL_REPOSITORY} " /new-file-{1,2,3}.txt
396402
397403 run git_auto_commit
398404
399405 assert_success
400406
401- assert_line " INPUT_TAGGING_MESSAGE : v2.0.0"
402- assert_line " ::debug::Create tag v2.0.0"
407+ assert_line " INPUT_TAG : v2.0.0"
408+ assert_line " ::debug::Create tag v2.0.0: MyProduct v2.0.0 "
403409 assert_line " ::debug::git push origin --tags"
404410
405411 # Assert a tag v2.0.0 has been created
@@ -413,16 +419,18 @@ cat_github_output() {
413419
414420@test " It pushes generated commit and tag to remote and actually updates the commit shas" {
415421 INPUT_BRANCH=" "
416- INPUT_TAGGING_MESSAGE=" v2.0.0"
422+ INPUT_TAG=" v2.0.0"
423+ INPUT_TAGGING_MESSAGE=" MyProduct v2.0.0"
424+
417425
418426 touch " ${FAKE_LOCAL_REPOSITORY} " /new-file-{1,2,3}.txt
419427
420428 run git_auto_commit
421429
422430 assert_success
423431
424- assert_line " INPUT_TAGGING_MESSAGE : v2.0.0"
425- assert_line " ::debug::Create tag v2.0.0"
432+ assert_line " INPUT_TAG : v2.0.0"
433+ assert_line " ::debug::Create tag v2.0.0: MyProduct v2.0.0 "
426434 assert_line " ::debug::git push origin --tags"
427435
428436 # Assert a tag v2.0.0 has been created
@@ -442,16 +450,18 @@ cat_github_output() {
442450
443451@test " It pushes generated commit and tag to remote branch and updates commit sha" {
444452 INPUT_BRANCH=" a-new-branch"
445- INPUT_TAGGING_MESSAGE=" v2.0.0"
453+ INPUT_TAG=" v2.0.0"
454+ INPUT_TAGGING_MESSAGE=" MyProduct v2.0.0"
455+
446456
447457 touch " ${FAKE_LOCAL_REPOSITORY} " /new-file-{1,2,3}.txt
448458
449459 run git_auto_commit
450460
451461 assert_success
452462
453- assert_line " INPUT_TAGGING_MESSAGE : v2.0.0"
454- assert_line " ::debug::Create tag v2.0.0"
463+ assert_line " INPUT_TAG : v2.0.0"
464+ assert_line " ::debug::Create tag v2.0.0: MyProduct v2.0.0 "
455465 assert_line " ::debug::Push commit to remote branch a-new-branch"
456466
457467 # Assert a tag v2.0.0 has been created
@@ -598,7 +608,7 @@ cat_github_output() {
598608 assert_line " INPUT_FILE_PATTERN: ."
599609 assert_line " INPUT_COMMIT_OPTIONS: "
600610 assert_line " ::debug::Apply commit options "
601- assert_line " INPUT_TAGGING_MESSAGE : "
611+ assert_line " INPUT_TAG : "
602612 assert_line " No tagging message supplied. No tag will be added."
603613 assert_line " INPUT_PUSH_OPTIONS: "
604614 assert_line " ::debug::Apply push options "
@@ -641,7 +651,7 @@ cat_github_output() {
641651 assert_line " INPUT_FILE_PATTERN: ."
642652 assert_line " INPUT_COMMIT_OPTIONS: "
643653 assert_line " ::debug::Apply commit options "
644- assert_line " INPUT_TAGGING_MESSAGE : "
654+ assert_line " INPUT_TAG : "
645655 assert_line " No tagging message supplied. No tag will be added."
646656 assert_line " INPUT_PUSH_OPTIONS: "
647657 assert_line " ::debug::Apply push options "
@@ -700,7 +710,7 @@ cat_github_output() {
700710 assert_line " INPUT_FILE_PATTERN: ."
701711 assert_line " INPUT_COMMIT_OPTIONS: "
702712 assert_line " ::debug::Apply commit options "
703- assert_line " INPUT_TAGGING_MESSAGE : "
713+ assert_line " INPUT_TAG : "
704714 assert_line " No tagging message supplied. No tag will be added."
705715 assert_line " INPUT_PUSH_OPTIONS: "
706716 assert_line " ::debug::Apply push options "
@@ -1031,7 +1041,7 @@ cat_github_output() {
10311041 assert_line " INPUT_FILE_PATTERN: ."
10321042 assert_line " INPUT_COMMIT_OPTIONS: "
10331043 assert_line " ::debug::Apply commit options "
1034- assert_line " INPUT_TAGGING_MESSAGE : "
1044+ assert_line " INPUT_TAG : "
10351045 assert_line " No tagging message supplied. No tag will be added."
10361046 assert_line " INPUT_PUSH_OPTIONS: "
10371047 assert_line " ::debug::Apply push options "
@@ -1119,15 +1129,16 @@ END
11191129
11201130@test " it creates a tag if create_git_tag_only is set to true and a message has been supplied" {
11211131 INPUT_CREATE_GIT_TAG_ONLY=true
1122- INPUT_TAGGING_MESSAGE=v1.0.0
1132+ INPUT_TAG=v1.0.0
1133+ INPUT_TAGGING_MESSAGE=" MyProduct v1.0.0"
11231134
11241135 run git_auto_commit
11251136
11261137 assert_success
11271138
11281139 assert_line " ::debug::Create git tag only"
11291140
1130- assert_line " ::debug::Create tag v1.0.0"
1141+ assert_line " ::debug::Create tag v1.0.0: MyProduct v1.0.0 "
11311142 refute_line " No tagging message supplied. No tag will be added."
11321143
11331144 assert_line " ::debug::Apply push options "
@@ -1139,22 +1150,22 @@ END
11391150 refute_line -e " commit_hash=[0-9a-f]{40}$"
11401151
11411152 # Assert a tag v1.0.0 has been created
1142- run git tag
1143- assert_output v1.0.0
1153+ run git tag -n
1154+ assert_output ' v1.0.0 MyProduct v1.0.0 '
11441155
11451156 run git ls-remote --tags --refs
11461157 assert_output --partial refs/tags/v1.0.0
11471158}
11481159
11491160@test " it output no tagging message supplied if no tagging message is set but create_git_tag_only is set to true" {
11501161 INPUT_CREATE_GIT_TAG_ONLY=true
1151- INPUT_TAGGING_MESSAGE =" "
1162+ INPUT_TAG =" "
11521163
11531164 run git_auto_commit
11541165
11551166 assert_success
11561167
1157- assert_line " INPUT_TAGGING_MESSAGE : "
1168+ assert_line " INPUT_TAG : "
11581169 assert_line " No tagging message supplied. No tag will be added."
11591170 assert_line " ::debug::Create git tag only"
11601171
@@ -1181,3 +1192,63 @@ END
11811192 assert_line " ::warning::git-auto-commit: skip_checkout has been removed in v6. It does not have any effect anymore."
11821193 assert_line " ::warning::git-auto-commit: create_branch has been removed in v6. It does not have any effect anymore."
11831194}
1195+
1196+ @test " Set a tag message only" {
1197+ INPUT_TAGGING_MESSAGE=" v1.0.0"
1198+
1199+ touch " ${FAKE_LOCAL_REPOSITORY} " /new-file-{1,2,3}.txt
1200+
1201+ run git_auto_commit
1202+
1203+ assert_success
1204+
1205+ assert_line " INPUT_TAG: "
1206+ assert_line " INPUT_TAGGING_MESSAGE: v1.0.0"
1207+
1208+ assert_line " ::debug::Create tag v1.0.0: v1.0.0"
1209+ assert_line " ::debug::Push commit to remote branch ${FAKE_DEFAULT_BRANCH} "
1210+
1211+ # Assert a tag v1.0.0 has been created
1212+ run git tag -n
1213+ assert_output ' v1.0.0 v1.0.0'
1214+
1215+ run git ls-remote --tags --refs
1216+ assert_output --partial refs/tags/v1.0.0
1217+
1218+ # Assert that the commit has been pushed with --force and
1219+ # sha values are equal on local and remote
1220+ current_sha=" $( git rev-parse --verify --short ${FAKE_DEFAULT_BRANCH} ) "
1221+ remote_sha=" $( git rev-parse --verify --short origin/${FAKE_DEFAULT_BRANCH} ) "
1222+
1223+ assert_equal $current_sha $remote_sha
1224+ }
1225+
1226+ @test " Set a tag only" {
1227+ INPUT_TAG=" v1.0.0"
1228+
1229+ touch " ${FAKE_LOCAL_REPOSITORY} " /new-file-{1,2,3}.txt
1230+
1231+ run git_auto_commit
1232+
1233+ assert_success
1234+
1235+ assert_line " INPUT_TAG: v1.0.0"
1236+ assert_line " INPUT_TAGGING_MESSAGE: "
1237+
1238+ assert_line " ::debug::Create tag v1.0.0: v1.0.0"
1239+ assert_line " ::debug::Push commit to remote branch ${FAKE_DEFAULT_BRANCH} "
1240+
1241+ # Assert a tag v1.0.0 has been created
1242+ run git tag -n
1243+ assert_output ' v1.0.0 v1.0.0'
1244+
1245+ run git ls-remote --tags --refs
1246+ assert_output --partial refs/tags/v1.0.0
1247+
1248+ # Assert that the commit has been pushed with --force and
1249+ # sha values are equal on local and remote
1250+ current_sha=" $( git rev-parse --verify --short ${FAKE_DEFAULT_BRANCH} ) "
1251+ remote_sha=" $( git rev-parse --verify --short origin/${FAKE_DEFAULT_BRANCH} ) "
1252+
1253+ assert_equal $current_sha $remote_sha
1254+ }
0 commit comments