@@ -8,6 +8,7 @@ load "${BATS_PLUGIN_PATH}/load.bash"
88
99setup () {
1010 export GITHUB_WORKSPACE=/tmp
11+ # export DEBUG=1
1112}
1213
1314@test " parses git status output and generates correct flags for ghcommit" {
@@ -17,6 +18,8 @@ setup() {
1718 local empty=' false'
1819 local file_pattern=' .'
1920
21+ export GITHUB_OUTPUT=" $BATS_TEST_TMPDIR /github-output"
22+
2023 # NOTE: we are passing our hand-crafted fixture through `tr` to convert newlines to nulls since
2124 # we run `git status -z` which uses null terminators. The newlines are meant to make the file easier
2225 # to modify and prevent cat from removing the leading space on lines/entries since that is a part
@@ -26,11 +29,13 @@ setup() {
2629 " status -s --porcelain=v1 -z -- . : cat ./tests/fixtures/git-status.out-1 | tr '\n' '\0'"
2730
2831 stub ghcommit \
29- ' -b main -r org/repo -m msg --add=README.md --add=foo.txt --add=new.file --delete=old.file --delete=\""a path with spaces oh joy/file.txt\"" : echo Success'
32+ ' -b main -r org/repo -m msg --add=README.md --add=foo.txt --add=new.file --delete=old.file --delete=\""a path with spaces oh joy/file.txt\"" : echo Success. New commit: https://localhost/foo '
3033
3134 run ./entrypoint.sh " $commit_message " " $repo " " $branch " " $empty " " $file_pattern "
3235 assert_success
3336 assert_output --partial " Success"
37+ assert_file_exist " $GITHUB_OUTPUT "
38+ assert_file_contains " $GITHUB_OUTPUT " " commit-url=https://localhost/foo"
3439}
3540
3641@test " no changes" {
@@ -56,14 +61,18 @@ setup() {
5661 local empty=' true'
5762 local file_pattern=' .'
5863
64+ export GITHUB_OUTPUT=" $BATS_TEST_TMPDIR /github-output"
65+
5966 stub git \
6067 " config --global --add safe.directory $GITHUB_WORKSPACE : echo stubbed" \
6168 " status -s --porcelain=v1 -z -- . : echo"
6269
6370 stub ghcommit \
64- ' -b main -r org/repo -m msg --empty : echo Success'
71+ ' -b main -r org/repo -m msg --empty : echo Success. New commit: https://localhost/foo '
6572
6673 run ./entrypoint.sh " $commit_message " " $repo " " $branch " " $empty " " $file_pattern "
6774 assert_success
6875 assert_output --partial " Success"
76+ assert_file_exist " $GITHUB_OUTPUT "
77+ assert_file_contains " $GITHUB_OUTPUT " " commit-url=https://localhost/foo"
6978}
0 commit comments