feat: support $/ prefix in action uses: (#1150)

Accepts GitHub's `$/` self-repository prefix in a step `uses:`. It resolves to the repository holding the file that wrote the `uses:`, at the ref being run, with no checkout. Inside a composite action that is the enclosing action, otherwise the workflow's own repo and commit.

The action cache is keyed on the resolved reference for these, because the same `$/x` names a different action per enclosing repository.

Related PR for job-level support: https://github.com/go-gitea/gitea/pull/38822

Reviewed-on: https://gitea.com/gitea/runner/pulls/1150
Reviewed-by: Zettat123 <[email protected]>
Co-authored-by: silverwind <[email protected]>
This commit is contained in:
silverwind
2026-08-07 17:36:58 +00:00
committed by silverwind
parent 24c13a1fd0
commit 9dd9204937
4 changed files with 111 additions and 7 deletions
+8 -2
View File
@@ -829,13 +829,19 @@ func (s *Step) Type() StepType {
} else if strings.HasPrefix(s.Uses, "./") {
return StepTypeUsesActionLocal
}
return StepTypeUsesActionRemote
return StepTypeUsesActionRemote // `$/` self-repository refs land here and resolve in prepareActionExecutor
}
// UsesHash returns a hash of the uses string.
// For Gitea.
func (s *Step) UsesHash() string {
return fmt.Sprintf("%x", sha256.Sum256([]byte(s.Uses)))
return UsesHash(s.Uses)
}
// UsesHash returns a hash of a `uses:` value.
// For Gitea.
func UsesHash(uses string) string {
return fmt.Sprintf("%x", sha256.Sum256([]byte(uses)))
}
// ReadWorkflow returns a list of jobs for a given workflow file reader