@@ -32,6 +32,7 @@ setup() {
3232 export INPUT_COMMIT_USER_NAME=" Test Suite"
3333 export INPUT_COMMIT_USER_EMAIL=
" [email protected] " 3434 export INPUT_COMMIT_AUTHOR=
" Test Suite <[email protected] >" 35+ export INPUT_TAG=" "
3536 export INPUT_TAGGING_MESSAGE=" "
3637 export INPUT_PUSH_OPTIONS=" "
3738 export INPUT_SKIP_DIRTY_CHECK=false
@@ -123,8 +124,9 @@ cat_github_output() {
123124 assert_line " INPUT_FILE_PATTERN: ."
124125 assert_line " INPUT_COMMIT_OPTIONS: "
125126 assert_line " ::debug::Apply commit options "
127+ assert_line " INPUT_TAG: "
126128 assert_line " INPUT_TAGGING_MESSAGE: "
127- assert_line " No tagging message supplied . No tag will be added."
129+ assert_line " Neither tag nor tag message is set . No tag will be added."
128130 assert_line " INPUT_PUSH_OPTIONS: "
129131 assert_line " ::debug::Apply push options "
130132 assert_line " ::debug::Push commit to remote branch ${FAKE_DEFAULT_BRANCH} "
@@ -146,8 +148,9 @@ cat_github_output() {
146148 assert_line " INPUT_FILE_PATTERN: ."
147149 assert_line " INPUT_COMMIT_OPTIONS: "
148150 assert_line " ::debug::Apply commit options "
151+ assert_line " INPUT_TAG: "
149152 assert_line " INPUT_TAGGING_MESSAGE: "
150- assert_line " No tagging message supplied . No tag will be added."
153+ assert_line " Neither tag nor tag message is set . No tag will be added."
151154 assert_line " INPUT_PUSH_OPTIONS: "
152155 assert_line " ::debug::Apply push options "
153156 assert_line " ::debug::Push commit to remote branch ${FAKE_DEFAULT_BRANCH} "
@@ -293,21 +296,24 @@ cat_github_output() {
293296}
294297
295298@test " It creates a tag with the commit" {
296- INPUT_TAGGING_MESSAGE=" v1.0.0"
299+ INPUT_TAG=" v1.0.0"
300+ INPUT_TAGGING_MESSAGE=" MyProduct v1.0.0"
297301
298302 touch " ${FAKE_LOCAL_REPOSITORY} " /new-file-{1,2,3}.txt
299303
300304 run git_auto_commit
301305
302306 assert_success
303307
304- assert_line " INPUT_TAGGING_MESSAGE: v1.0.0"
305- assert_line " ::debug::Create tag v1.0.0"
308+ assert_line " INPUT_TAG: v1.0.0"
309+ assert_line " INPUT_TAGGING_MESSAGE: MyProduct v1.0.0"
310+
311+ assert_line " ::debug::Create tag v1.0.0: MyProduct v1.0.0"
306312 assert_line " ::debug::Push commit to remote branch ${FAKE_DEFAULT_BRANCH} "
307313
308314 # Assert a tag v1.0.0 has been created
309- run git tag
310- assert_output v1.0.0
315+ run git tag -n
316+ assert_output ' v1.0.0 MyProduct v1.0.0 '
311317
312318 run git ls-remote --tags --refs
313319 assert_output --partial refs/tags/v1.0.0
@@ -388,18 +394,20 @@ cat_github_output() {
388394 assert_equal $current_sha $remote_sha
389395}
390396
391- @test " It uses existing branch when INPUT_BRANCH is empty and INPUT_TAGGING_MESSAGE is set" {
397+ @test " It uses existing branch when INPUT_BRANCH is empty and INPUT_TAG is set" {
392398 INPUT_BRANCH=" "
393- INPUT_TAGGING_MESSAGE=" v2.0.0"
399+ INPUT_TAG=" v2.0.0"
400+ INPUT_TAGGING_MESSAGE=" MyProduct v2.0.0"
401+
394402
395403 touch " ${FAKE_LOCAL_REPOSITORY} " /new-file-{1,2,3}.txt
396404
397405 run git_auto_commit
398406
399407 assert_success
400408
401- assert_line " INPUT_TAGGING_MESSAGE : v2.0.0"
402- assert_line " ::debug::Create tag v2.0.0"
409+ assert_line " INPUT_TAG : v2.0.0"
410+ assert_line " ::debug::Create tag v2.0.0: MyProduct v2.0.0 "
403411 assert_line " ::debug::git push origin --tags"
404412
405413 # Assert a tag v2.0.0 has been created
@@ -413,16 +421,18 @@ cat_github_output() {
413421
414422@test " It pushes generated commit and tag to remote and actually updates the commit shas" {
415423 INPUT_BRANCH=" "
416- INPUT_TAGGING_MESSAGE=" v2.0.0"
424+ INPUT_TAG=" v2.0.0"
425+ INPUT_TAGGING_MESSAGE=" MyProduct v2.0.0"
426+
417427
418428 touch " ${FAKE_LOCAL_REPOSITORY} " /new-file-{1,2,3}.txt
419429
420430 run git_auto_commit
421431
422432 assert_success
423433
424- assert_line " INPUT_TAGGING_MESSAGE : v2.0.0"
425- assert_line " ::debug::Create tag v2.0.0"
434+ assert_line " INPUT_TAG : v2.0.0"
435+ assert_line " ::debug::Create tag v2.0.0: MyProduct v2.0.0 "
426436 assert_line " ::debug::git push origin --tags"
427437
428438 # Assert a tag v2.0.0 has been created
@@ -442,16 +452,18 @@ cat_github_output() {
442452
443453@test " It pushes generated commit and tag to remote branch and updates commit sha" {
444454 INPUT_BRANCH=" a-new-branch"
445- INPUT_TAGGING_MESSAGE=" v2.0.0"
455+ INPUT_TAG=" v2.0.0"
456+ INPUT_TAGGING_MESSAGE=" MyProduct v2.0.0"
457+
446458
447459 touch " ${FAKE_LOCAL_REPOSITORY} " /new-file-{1,2,3}.txt
448460
449461 run git_auto_commit
450462
451463 assert_success
452464
453- assert_line " INPUT_TAGGING_MESSAGE : v2.0.0"
454- assert_line " ::debug::Create tag v2.0.0"
465+ assert_line " INPUT_TAG : v2.0.0"
466+ assert_line " ::debug::Create tag v2.0.0: MyProduct v2.0.0 "
455467 assert_line " ::debug::Push commit to remote branch a-new-branch"
456468
457469 # Assert a tag v2.0.0 has been created
@@ -598,8 +610,9 @@ cat_github_output() {
598610 assert_line " INPUT_FILE_PATTERN: ."
599611 assert_line " INPUT_COMMIT_OPTIONS: "
600612 assert_line " ::debug::Apply commit options "
613+ assert_line " INPUT_TAG: "
601614 assert_line " INPUT_TAGGING_MESSAGE: "
602- assert_line " No tagging message supplied . No tag will be added."
615+ assert_line " Neither tag nor tag message is set . No tag will be added."
603616 assert_line " INPUT_PUSH_OPTIONS: "
604617 assert_line " ::debug::Apply push options "
605618 assert_line " ::debug::Push commit to remote branch not-existend-branch"
@@ -641,8 +654,9 @@ cat_github_output() {
641654 assert_line " INPUT_FILE_PATTERN: ."
642655 assert_line " INPUT_COMMIT_OPTIONS: "
643656 assert_line " ::debug::Apply commit options "
657+ assert_line " INPUT_TAG: "
644658 assert_line " INPUT_TAGGING_MESSAGE: "
645- assert_line " No tagging message supplied . No tag will be added."
659+ assert_line " Neither tag nor tag message is set . No tag will be added."
646660 assert_line " INPUT_PUSH_OPTIONS: "
647661 assert_line " ::debug::Apply push options "
648662 assert_line " ::debug::Push commit to remote branch not-existend-remote-branch"
@@ -700,8 +714,9 @@ cat_github_output() {
700714 assert_line " INPUT_FILE_PATTERN: ."
701715 assert_line " INPUT_COMMIT_OPTIONS: "
702716 assert_line " ::debug::Apply commit options "
717+ assert_line " INPUT_TAG: "
703718 assert_line " INPUT_TAGGING_MESSAGE: "
704- assert_line " No tagging message supplied . No tag will be added."
719+ assert_line " Neither tag nor tag message is set . No tag will be added."
705720 assert_line " INPUT_PUSH_OPTIONS: "
706721 assert_line " ::debug::Apply push options "
707722 assert_line " ::debug::Push commit to remote branch existing-remote-branch"
@@ -1031,8 +1046,9 @@ cat_github_output() {
10311046 assert_line " INPUT_FILE_PATTERN: ."
10321047 assert_line " INPUT_COMMIT_OPTIONS: "
10331048 assert_line " ::debug::Apply commit options "
1049+ assert_line " INPUT_TAG: "
10341050 assert_line " INPUT_TAGGING_MESSAGE: "
1035- assert_line " No tagging message supplied . No tag will be added."
1051+ assert_line " Neither tag nor tag message is set . No tag will be added."
10361052 assert_line " INPUT_PUSH_OPTIONS: "
10371053 assert_line " ::debug::Apply push options "
10381054 assert_line " ::debug::Push commit to remote branch ${FAKE_DEFAULT_BRANCH} "
@@ -1119,16 +1135,17 @@ END
11191135
11201136@test " it creates a tag if create_git_tag_only is set to true and a message has been supplied" {
11211137 INPUT_CREATE_GIT_TAG_ONLY=true
1122- INPUT_TAGGING_MESSAGE=v1.0.0
1138+ INPUT_TAG=v1.0.0
1139+ INPUT_TAGGING_MESSAGE=" MyProduct v1.0.0"
11231140
11241141 run git_auto_commit
11251142
11261143 assert_success
11271144
11281145 assert_line " ::debug::Create git tag only"
11291146
1130- assert_line " ::debug::Create tag v1.0.0"
1131- refute_line " No tagging message supplied . No tag will be added."
1147+ assert_line " ::debug::Create tag v1.0.0: MyProduct v1.0.0 "
1148+ refute_line " Neither tag nor tag message is set . No tag will be added."
11321149
11331150 assert_line " ::debug::Apply push options "
11341151 assert_line " ::debug::Push commit to remote branch ${FAKE_DEFAULT_BRANCH} "
@@ -1139,23 +1156,25 @@ END
11391156 refute_line -e " commit_hash=[0-9a-f]{40}$"
11401157
11411158 # Assert a tag v1.0.0 has been created
1142- run git tag
1143- assert_output v1.0.0
1159+ run git tag -n
1160+ assert_output ' v1.0.0 MyProduct v1.0.0 '
11441161
11451162 run git ls-remote --tags --refs
11461163 assert_output --partial refs/tags/v1.0.0
11471164}
11481165
11491166@test " it output no tagging message supplied if no tagging message is set but create_git_tag_only is set to true" {
11501167 INPUT_CREATE_GIT_TAG_ONLY=true
1168+ INPUT_TAG=" "
11511169 INPUT_TAGGING_MESSAGE=" "
11521170
11531171 run git_auto_commit
11541172
11551173 assert_success
11561174
1175+ assert_line " INPUT_TAG: "
11571176 assert_line " INPUT_TAGGING_MESSAGE: "
1158- assert_line " No tagging message supplied . No tag will be added."
1177+ assert_line " Neither tag nor tag message is set . No tag will be added."
11591178 assert_line " ::debug::Create git tag only"
11601179
11611180 run cat_github_output
@@ -1181,3 +1200,63 @@ END
11811200 assert_line " ::warning::git-auto-commit: skip_checkout has been removed in v6. It does not have any effect anymore."
11821201 assert_line " ::warning::git-auto-commit: create_branch has been removed in v6. It does not have any effect anymore."
11831202}
1203+
1204+ @test " Set a tag message only" {
1205+ INPUT_TAGGING_MESSAGE=" v1.0.0"
1206+
1207+ touch " ${FAKE_LOCAL_REPOSITORY} " /new-file-{1,2,3}.txt
1208+
1209+ run git_auto_commit
1210+
1211+ assert_success
1212+
1213+ assert_line " INPUT_TAG: "
1214+ assert_line " INPUT_TAGGING_MESSAGE: v1.0.0"
1215+
1216+ assert_line " ::debug::Create tag v1.0.0: v1.0.0"
1217+ assert_line " ::debug::Push commit to remote branch ${FAKE_DEFAULT_BRANCH} "
1218+
1219+ # Assert a tag v1.0.0 has been created
1220+ run git tag -n
1221+ assert_output ' v1.0.0 v1.0.0'
1222+
1223+ run git ls-remote --tags --refs
1224+ assert_output --partial refs/tags/v1.0.0
1225+
1226+ # Assert that the commit has been pushed with --force and
1227+ # sha values are equal on local and remote
1228+ current_sha=" $( git rev-parse --verify --short ${FAKE_DEFAULT_BRANCH} ) "
1229+ remote_sha=" $( git rev-parse --verify --short origin/${FAKE_DEFAULT_BRANCH} ) "
1230+
1231+ assert_equal $current_sha $remote_sha
1232+ }
1233+
1234+ @test " Set a tag only" {
1235+ INPUT_TAG=" v1.0.0"
1236+
1237+ touch " ${FAKE_LOCAL_REPOSITORY} " /new-file-{1,2,3}.txt
1238+
1239+ run git_auto_commit
1240+
1241+ assert_success
1242+
1243+ assert_line " INPUT_TAG: v1.0.0"
1244+ assert_line " INPUT_TAGGING_MESSAGE: "
1245+
1246+ assert_line " ::debug::Create tag v1.0.0: v1.0.0"
1247+ assert_line " ::debug::Push commit to remote branch ${FAKE_DEFAULT_BRANCH} "
1248+
1249+ # Assert a tag v1.0.0 has been created
1250+ run git tag -n
1251+ assert_output ' v1.0.0 v1.0.0'
1252+
1253+ run git ls-remote --tags --refs
1254+ assert_output --partial refs/tags/v1.0.0
1255+
1256+ # Assert that the commit has been pushed with --force and
1257+ # sha values are equal on local and remote
1258+ current_sha=" $( git rev-parse --verify --short ${FAKE_DEFAULT_BRANCH} ) "
1259+ remote_sha=" $( git rev-parse --verify --short origin/${FAKE_DEFAULT_BRANCH} ) "
1260+
1261+ assert_equal $current_sha $remote_sha
1262+ }
0 commit comments