@@ -32,7 +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_TAGGING_MESSAGE =" "
35+ export INPUT_TAG =" "
3636 export INPUT_PUSH_OPTIONS=" "
3737 export INPUT_SKIP_DIRTY_CHECK=false
3838 export INPUT_DISABLE_GLOBBING=false
@@ -123,7 +123,7 @@ cat_github_output() {
123123 assert_line " INPUT_FILE_PATTERN: ."
124124 assert_line " INPUT_COMMIT_OPTIONS: "
125125 assert_line " ::debug::Apply commit options "
126- assert_line " INPUT_TAGGING_MESSAGE : "
126+ assert_line " INPUT_TAG : "
127127 assert_line " No tagging message supplied. No tag will be added."
128128 assert_line " INPUT_PUSH_OPTIONS: "
129129 assert_line " ::debug::Apply push options "
@@ -146,7 +146,7 @@ cat_github_output() {
146146 assert_line " INPUT_FILE_PATTERN: ."
147147 assert_line " INPUT_COMMIT_OPTIONS: "
148148 assert_line " ::debug::Apply commit options "
149- assert_line " INPUT_TAGGING_MESSAGE : "
149+ assert_line " INPUT_TAG : "
150150 assert_line " No tagging message supplied. No tag will be added."
151151 assert_line " INPUT_PUSH_OPTIONS: "
152152 assert_line " ::debug::Apply push options "
@@ -293,21 +293,24 @@ cat_github_output() {
293293}
294294
295295@test " It creates a tag with the commit" {
296- INPUT_TAGGING_MESSAGE=" v1.0.0"
296+ INPUT_TAG=" v1.0.0"
297+ INPUT_TAGGING_MESSAGE=" MyProduct v1.0.0"
297298
298299 touch " ${FAKE_LOCAL_REPOSITORY} " /new-file-{1,2,3}.txt
299300
300301 run git_auto_commit
301302
302303 assert_success
303304
304- assert_line " INPUT_TAGGING_MESSAGE: v1.0.0"
305- assert_line " ::debug::Create tag v1.0.0"
305+ assert_line " INPUT_TAG: v1.0.0"
306+ assert_line " INPUT_TAGGING_MESSAGE: MyProduct v1.0.0"
307+
308+ assert_line " ::debug::Create tag v1.0.0: MyProduct v1.0.0"
306309 assert_line " ::debug::Push commit to remote branch ${FAKE_DEFAULT_BRANCH} "
307310
308311 # Assert a tag v1.0.0 has been created
309- run git tag
310- assert_output v1.0.0
312+ run git tag -n
313+ assert_output v1.0.0 MyProduct v1.0.0
311314
312315 run git ls-remote --tags --refs
313316 assert_output --partial refs/tags/v1.0.0
@@ -388,18 +391,20 @@ cat_github_output() {
388391 assert_equal $current_sha $remote_sha
389392}
390393
391- @test " It uses existing branch when INPUT_BRANCH is empty and INPUT_TAGGING_MESSAGE is set" {
394+ @test " It uses existing branch when INPUT_BRANCH is empty and INPUT_TAG is set" {
392395 INPUT_BRANCH=" "
393- INPUT_TAGGING_MESSAGE=" v2.0.0"
396+ INPUT_TAG=" v2.0.0"
397+ INPUT_TAGGING_MESSAGE=" MyPoduct v2.0.0"
398+
394399
395400 touch " ${FAKE_LOCAL_REPOSITORY} " /new-file-{1,2,3}.txt
396401
397402 run git_auto_commit
398403
399404 assert_success
400405
401- assert_line " INPUT_TAGGING_MESSAGE : v2.0.0"
402- assert_line " ::debug::Create tag v2.0.0"
406+ assert_line " INPUT_TAG : v2.0.0"
407+ assert_line " ::debug::Create tag v2.0.0: MyProduct v2.0.0 "
403408 assert_line " ::debug::git push origin --tags"
404409
405410 # Assert a tag v2.0.0 has been created
@@ -413,16 +418,18 @@ cat_github_output() {
413418
414419@test " It pushes generated commit and tag to remote and actually updates the commit shas" {
415420 INPUT_BRANCH=" "
416- INPUT_TAGGING_MESSAGE=" v2.0.0"
421+ INPUT_TAG=" v2.0.0"
422+ INPUT_TAGGING_MESSAGE=" MyPoduct v2.0.0"
423+
417424
418425 touch " ${FAKE_LOCAL_REPOSITORY} " /new-file-{1,2,3}.txt
419426
420427 run git_auto_commit
421428
422429 assert_success
423430
424- assert_line " INPUT_TAGGING_MESSAGE : v2.0.0"
425- assert_line " ::debug::Create tag v2.0.0"
431+ assert_line " INPUT_TAG : v2.0.0"
432+ assert_line " ::debug::Create tag v2.0.0: MyProduct v2.0.0 "
426433 assert_line " ::debug::git push origin --tags"
427434
428435 # Assert a tag v2.0.0 has been created
@@ -442,16 +449,18 @@ cat_github_output() {
442449
443450@test " It pushes generated commit and tag to remote branch and updates commit sha" {
444451 INPUT_BRANCH=" a-new-branch"
445- INPUT_TAGGING_MESSAGE=" v2.0.0"
452+ INPUT_TAG=" v2.0.0"
453+ INPUT_TAGGING_MESSAGE=" MyPoduct v2.0.0"
454+
446455
447456 touch " ${FAKE_LOCAL_REPOSITORY} " /new-file-{1,2,3}.txt
448457
449458 run git_auto_commit
450459
451460 assert_success
452461
453- assert_line " INPUT_TAGGING_MESSAGE : v2.0.0"
454- assert_line " ::debug::Create tag v2.0.0"
462+ assert_line " INPUT_TAG : v2.0.0"
463+ assert_line " ::debug::Create tag v2.0.0: MyProduct v2.0.0 "
455464 assert_line " ::debug::Push commit to remote branch a-new-branch"
456465
457466 # Assert a tag v2.0.0 has been created
@@ -598,7 +607,7 @@ cat_github_output() {
598607 assert_line " INPUT_FILE_PATTERN: ."
599608 assert_line " INPUT_COMMIT_OPTIONS: "
600609 assert_line " ::debug::Apply commit options "
601- assert_line " INPUT_TAGGING_MESSAGE : "
610+ assert_line " INPUT_TAG : "
602611 assert_line " No tagging message supplied. No tag will be added."
603612 assert_line " INPUT_PUSH_OPTIONS: "
604613 assert_line " ::debug::Apply push options "
@@ -641,7 +650,7 @@ cat_github_output() {
641650 assert_line " INPUT_FILE_PATTERN: ."
642651 assert_line " INPUT_COMMIT_OPTIONS: "
643652 assert_line " ::debug::Apply commit options "
644- assert_line " INPUT_TAGGING_MESSAGE : "
653+ assert_line " INPUT_TAG : "
645654 assert_line " No tagging message supplied. No tag will be added."
646655 assert_line " INPUT_PUSH_OPTIONS: "
647656 assert_line " ::debug::Apply push options "
@@ -700,7 +709,7 @@ cat_github_output() {
700709 assert_line " INPUT_FILE_PATTERN: ."
701710 assert_line " INPUT_COMMIT_OPTIONS: "
702711 assert_line " ::debug::Apply commit options "
703- assert_line " INPUT_TAGGING_MESSAGE : "
712+ assert_line " INPUT_TAG : "
704713 assert_line " No tagging message supplied. No tag will be added."
705714 assert_line " INPUT_PUSH_OPTIONS: "
706715 assert_line " ::debug::Apply push options "
@@ -1031,7 +1040,7 @@ cat_github_output() {
10311040 assert_line " INPUT_FILE_PATTERN: ."
10321041 assert_line " INPUT_COMMIT_OPTIONS: "
10331042 assert_line " ::debug::Apply commit options "
1034- assert_line " INPUT_TAGGING_MESSAGE : "
1043+ assert_line " INPUT_TAG : "
10351044 assert_line " No tagging message supplied. No tag will be added."
10361045 assert_line " INPUT_PUSH_OPTIONS: "
10371046 assert_line " ::debug::Apply push options "
@@ -1120,14 +1129,15 @@ END
11201129@test " it creates a tag if create_git_tag_only is set to true and a message has been supplied" {
11211130 INPUT_CREATE_GIT_TAG_ONLY=true
11221131 INPUT_TAGGING_MESSAGE=v1.0.0
1132+ INPUT_TAGGING_MESSAGE=" MyPoduct v1.0.0"
11231133
11241134 run git_auto_commit
11251135
11261136 assert_success
11271137
11281138 assert_line " ::debug::Create git tag only"
11291139
1130- assert_line " ::debug::Create tag v1.0.0"
1140+ assert_line " ::debug::Create tag v1.0.0: MyPoduct v1.0.0 "
11311141 refute_line " No tagging message supplied. No tag will be added."
11321142
11331143 assert_line " ::debug::Apply push options "
@@ -1148,13 +1158,13 @@ END
11481158
11491159@test " it output no tagging message supplied if no tagging message is set but create_git_tag_only is set to true" {
11501160 INPUT_CREATE_GIT_TAG_ONLY=true
1151- INPUT_TAGGING_MESSAGE =" "
1161+ INPUT_TAG =" "
11521162
11531163 run git_auto_commit
11541164
11551165 assert_success
11561166
1157- assert_line " INPUT_TAGGING_MESSAGE : "
1167+ assert_line " INPUT_TAG : "
11581168 assert_line " No tagging message supplied. No tag will be added."
11591169 assert_line " ::debug::Create git tag only"
11601170
@@ -1181,3 +1191,63 @@ END
11811191 assert_line " ::warning::git-auto-commit: skip_checkout has been removed in v6. It does not have any effect anymore."
11821192 assert_line " ::warning::git-auto-commit: create_branch has been removed in v6. It does not have any effect anymore."
11831193}
1194+
1195+ @test " Set a tag message only" {
1196+ INPUT_TAGGING_MESSAGE=" v1.0.0"
1197+
1198+ touch " ${FAKE_LOCAL_REPOSITORY} " /new-file-{1,2,3}.txt
1199+
1200+ run git_auto_commit
1201+
1202+ assert_success
1203+
1204+ assert_line " INPUT_TAG: "
1205+ assert_line " INPUT_TAGGING_MESSAGE: v1.0.0"
1206+
1207+ assert_line " ::debug::Create tag v1.0.0: v1.0.0"
1208+ assert_line " ::debug::Push commit to remote branch ${FAKE_DEFAULT_BRANCH} "
1209+
1210+ # Assert a tag v1.0.0 has been created
1211+ run git tag -n
1212+ assert_output v1.0.0 v1.0.0
1213+
1214+ run git ls-remote --tags --refs
1215+ assert_output --partial refs/tags/v1.0.0
1216+
1217+ # Assert that the commit has been pushed with --force and
1218+ # sha values are equal on local and remote
1219+ current_sha=" $( git rev-parse --verify --short ${FAKE_DEFAULT_BRANCH} ) "
1220+ remote_sha=" $( git rev-parse --verify --short origin/${FAKE_DEFAULT_BRANCH} ) "
1221+
1222+ assert_equal $current_sha $remote_sha
1223+ }
1224+
1225+ @test " Set a tag only" {
1226+ INPUT_TAG=" v1.0.0"
1227+
1228+ touch " ${FAKE_LOCAL_REPOSITORY} " /new-file-{1,2,3}.txt
1229+
1230+ run git_auto_commit
1231+
1232+ assert_success
1233+
1234+ assert_line " INPUT_TAG: v1.0.0"
1235+ assert_line " INPUT_TAGGING_MESSAGE: "
1236+
1237+ assert_line " ::debug::Create tag v1.0.0: v1.0.0"
1238+ assert_line " ::debug::Push commit to remote branch ${FAKE_DEFAULT_BRANCH} "
1239+
1240+ # Assert a tag v1.0.0 has been created
1241+ run git tag -n
1242+ assert_output v1.0.0 v1.0.0
1243+
1244+ run git ls-remote --tags --refs
1245+ assert_output --partial refs/tags/v1.0.0
1246+
1247+ # Assert that the commit has been pushed with --force and
1248+ # sha values are equal on local and remote
1249+ current_sha=" $( git rev-parse --verify --short ${FAKE_DEFAULT_BRANCH} ) "
1250+ remote_sha=" $( git rev-parse --verify --short origin/${FAKE_DEFAULT_BRANCH} ) "
1251+
1252+ assert_equal $current_sha $remote_sha
1253+ }
0 commit comments