mirror of
https://github.com/go-gitea/gitea.git
synced 2026-08-09 09:12:25 +00:00
feat(actions): support $/ prefix in reusable workflow uses: (#38822)
Fixes: https://github.com/go-gitea/gitea/issues/38818 Accepts GitHub's `$/` self-repository prefix in a reusable workflow `uses:`, alongside `./`. Gitea's `./` already resolves against the caller's own source repo and commit, which is what `$/` means, so the two are aliases here. Cycle detection folds both prefixes onto one key. Related PR for step-level support: https://gitea.com/gitea/runner/pulls/1150
This commit is contained in:
@@ -42,6 +42,17 @@ func TestCheckCallerChain_Cycle(t *testing.T) {
|
||||
assert.ErrorContains(t, err, "cycle detected")
|
||||
})
|
||||
|
||||
t.Run("MixedPrefixCycle", func(t *testing.T) {
|
||||
require.NoError(t, unittest.PrepareTestDatabase())
|
||||
// A -> A written with both same-repo prefixes: they name the same file.
|
||||
chain := buildCallerChain(t,
|
||||
"./.gitea/workflows/a.yml",
|
||||
"$/.gitea/workflows/a.yml",
|
||||
)
|
||||
err := checkCallerChain(t.Context(), chain[len(chain)-1])
|
||||
assert.ErrorContains(t, err, "cycle detected")
|
||||
})
|
||||
|
||||
t.Run("NoCycle", func(t *testing.T) {
|
||||
require.NoError(t, unittest.PrepareTestDatabase())
|
||||
// Sanity: linear chain with distinct CallUses must not trip cycle detection.
|
||||
|
||||
Reference in New Issue
Block a user