Skip to content

Commit 0658058

Browse files
fix: handle untracked files in git status
1 parent 3f30970 commit 0658058

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

tests/entrypoint.bats

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,3 +77,26 @@ setup() {
7777
assert_file_exist "$GITHUB_OUTPUT"
7878
assert_file_contains "$GITHUB_OUTPUT" "commit-url=https://localhost/foo"
7979
}
80+
81+
@test "handles untracked files" {
82+
local commit_message='msg'
83+
local repo='org/repo'
84+
local branch='main'
85+
local empty='false'
86+
local file_pattern='.'
87+
88+
export GITHUB_OUTPUT="$BATS_TEST_TMPDIR/github-output"
89+
90+
stub git \
91+
"config --global --add safe.directory $GITHUB_WORKSPACE : echo stubbed" \
92+
"status -s --porcelain=v1 -z -- . : cat ./tests/fixtures/git-status.out-2 | tr '\n' '\0'"
93+
94+
stub ghcommit \
95+
'-b main -r org/repo -m msg --add=untracked.txt --add=new-file.md --add=modified.txt : echo Success. New commit: https://localhost/bar'
96+
97+
run ./entrypoint.sh "$commit_message" "$repo" "$branch" "$empty" "$file_pattern"
98+
assert_success
99+
assert_output --partial "Success"
100+
assert_file_exist "$GITHUB_OUTPUT"
101+
assert_file_contains "$GITHUB_OUTPUT" "commit-url=https://localhost/bar"
102+
}

0 commit comments

Comments
 (0)