feat(build): treat current directory as workflow target

Co-Authored-By: Virgil <virgil@lethean.io>
This commit is contained in:
Virgil 2026-04-01 22:33:34 +00:00
parent 59e9d9168b
commit 7cf8b504f0
2 changed files with 14 additions and 0 deletions

View file

@ -182,6 +182,10 @@ func isWorkflowDirectoryPath(path string) bool {
return false
}
if path == "." || path == "./" || path == ".\\" {
return true
}
last := path[len(path)-1]
return last == '/' || last == '\\'
}

View file

@ -124,6 +124,10 @@ func TestWorkflow_ResolveReleaseWorkflowPath_Good(t *testing.T) {
assert.Equal(t, "/tmp/project/ci/release.yml", ResolveReleaseWorkflowPath("/tmp/project", "ci"))
})
t.Run("treats the current directory as a workflow directory", func(t *testing.T) {
assert.Equal(t, "/tmp/project/release.yml", ResolveReleaseWorkflowPath("/tmp/project", "."))
})
t.Run("treats trailing-slash relative paths as directories", func(t *testing.T) {
assert.Equal(t, "/tmp/project/ci/release.yml", ResolveReleaseWorkflowPath("/tmp/project", "ci/"))
})
@ -156,6 +160,12 @@ func TestWorkflow_ResolveReleaseWorkflowInputPath_Good(t *testing.T) {
assert.Equal(t, "/tmp/project/ci/release.yml", path)
})
t.Run("accepts the current directory as the primary input", func(t *testing.T) {
path, err := ResolveReleaseWorkflowInputPath("/tmp/project", ".", "")
require.NoError(t, err)
assert.Equal(t, "/tmp/project/release.yml", path)
})
t.Run("accepts output as an alias for path", func(t *testing.T) {
path, err := ResolveReleaseWorkflowInputPath("/tmp/project", "", "ci/release.yml")
require.NoError(t, err)