1
0
mirror of https://gitea.com/gitea/act synced 2026-05-01 01:27:48 +02:00

fix v4 upgrade

This commit is contained in:
Christopher Homberger
2025-10-27 21:51:40 +01:00
parent 0dbc9e6496
commit dd9cb630d1

View File

@@ -50,17 +50,18 @@ func (w *SingleWorkflow) SetJob(id string, job *Job) error {
m := map[string]*Job{
id: job,
}
buf, err := yaml.Marshal(m)
if err != nil {
return err
}
var buf bytes.Buffer
encoder := yaml.NewEncoder(&buf)
encoder.SetIndent(2)
encoder.Encode(m)
encoder.Close()
node := yaml.Node{}
if err := yaml.Unmarshal(buf, &node); err != nil {
if err := yaml.Unmarshal(buf.Bytes(), &node); err != nil {
return err
}
if len(node.Content) != 1 || node.Content[0].Kind != yaml.MappingNode {
return fmt.Errorf("can not set job: %s", string(buf))
return fmt.Errorf("can not set job: %s", buf.String())
}
w.RawJobs = *node.Content[0]
return nil