0
0
mirror of https://github.com/go-gitea/gitea.git synced 2026-06-18 00:43:38 +02:00

feat: Rename the newSingleWorkflow function to Clone

Signed-off-by: Pascal Zimmermann <pascal.zimmermann@theiotstudio.com>
This commit is contained in:
Pascal Zimmermann 2026-06-17 17:47:59 +02:00 committed by ZPascal
parent b33dfac0ac
commit 39bc278497

View File

@ -109,7 +109,7 @@ func Parse(content []byte, options ...ParseOption) ([]*SingleWorkflow, error) {
if placeholder.Name == "" {
placeholder.Name = id
}
swf := newSingleWorkflow(workflow)
swf := workflow.Clone()
if err := swf.SetJob(id, placeholder); err != nil {
return nil, fmt.Errorf("SetJob: %w", err)
}
@ -125,7 +125,7 @@ func Parse(content []byte, options ...ParseOption) ([]*SingleWorkflow, error) {
return nil, fmt.Errorf("getMatrixes: %w", err)
}
for _, matrix := range matricxes {
swf := newSingleWorkflow(workflow)
swf := workflow.Clone()
if err := swf.SetJob(id, expandJobCombo(id, job, matrix, evaluatedJob, pc.gitContext, results, pc.vars, pc.inputs)); err != nil {
return nil, fmt.Errorf("SetJob: %w", err)
}
@ -135,8 +135,8 @@ func Parse(content []byte, options ...ParseOption) ([]*SingleWorkflow, error) {
return ret, nil
}
// newSingleWorkflow returns a SingleWorkflow carrying w's global fields and no job.
func newSingleWorkflow(w *SingleWorkflow) *SingleWorkflow {
// Clone returns a copy of w with its global fields but no jobs.
func (w *SingleWorkflow) Clone() *SingleWorkflow {
return &SingleWorkflow{
Name: w.Name,
RawOn: w.RawOn,