mirror of
https://github.com/go-gitea/gitea.git
synced 2026-10-06 01:44:26 +02:00
feat: Rename the newSingleWorkflow function to Clone
Signed-off-by: Pascal Zimmermann <pascal.zimmermann@theiotstudio.com>
This commit is contained in:
1 parent
b33dfac0ac
commit
39bc278497
1 file changed
+4
-4
@@ -109,7 +109,7 @@ func Parse(content []byte, options ...ParseOption) ([]*SingleWorkflow, error) {
|
|||||||
if placeholder.Name == "" {
|
if placeholder.Name == "" {
|
||||||
placeholder.Name = id
|
placeholder.Name = id
|
||||||
}
|
}
|
||||||
swf := newSingleWorkflow(workflow)
|
swf := workflow.Clone()
|
||||||
if err := swf.SetJob(id, placeholder); err != nil {
|
if err := swf.SetJob(id, placeholder); err != nil {
|
||||||
return nil, fmt.Errorf("SetJob: %w", err)
|
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)
|
return nil, fmt.Errorf("getMatrixes: %w", err)
|
||||||
}
|
}
|
||||||
for _, matrix := range matricxes {
|
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 {
|
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)
|
return nil, fmt.Errorf("SetJob: %w", err)
|
||||||
}
|
}
|
||||||
@@ -135,8 +135,8 @@ func Parse(content []byte, options ...ParseOption) ([]*SingleWorkflow, error) {
|
|||||||
return ret, nil
|
return ret, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// newSingleWorkflow returns a SingleWorkflow carrying w's global fields and no job.
|
// Clone returns a copy of w with its global fields but no jobs.
|
||||||
func newSingleWorkflow(w *SingleWorkflow) *SingleWorkflow {
|
func (w *SingleWorkflow) Clone() *SingleWorkflow {
|
||||||
return &SingleWorkflow{
|
return &SingleWorkflow{
|
||||||
Name: w.Name,
|
Name: w.Name,
|
||||||
RawOn: w.RawOn,
|
RawOn: w.RawOn,
|
||||||
|
|||||||
Reference in new issue
Block a user