Skip to content

Commit 81ed506

Browse files
committed
[core] Subworkflow template expression resolution in repos package
1 parent 0cc8501 commit 81ed506

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

core/repos/repo.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,21 @@ func (r *Repo) ResolveTaskClassIdentifier(loadTaskClass string) (taskClassIdenti
133133
return
134134
}
135135

136+
func (r *Repo) ResolveSubworkflowTemplateIdentifier(workflowTemplateExpr string) string {
137+
expr := workflowTemplateExpr
138+
if !strings.Contains(expr, "/") {
139+
expr = r.HostingSite + "/" + r.User + "/" + r.RepoName + "/workflows/" + expr
140+
}
141+
142+
if !strings.Contains(expr, "@") {
143+
expr += "@" + r.Revision
144+
} else {
145+
expr += "@" + r.Hash
146+
}
147+
148+
return expr
149+
}
150+
136151
func (r *Repo) checkoutRevision(revision string) error {
137152
if revision == "" {
138153
revision = r.Revision

0 commit comments

Comments
 (0)