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

Use go.yaml.in/yaml/v4

This commit is contained in:
Christopher Homberger
2025-10-27 21:46:21 +01:00
parent 7c6118ea2e
commit 0dbc9e6496
18 changed files with 26 additions and 24 deletions

View File

@@ -6,7 +6,7 @@ import (
"strings"
"github.com/nektos/act/pkg/exprparser"
"gopkg.in/yaml.v3"
"go.yaml.in/yaml/v4"
)
// ExpressionEvaluator is copied from runner.expressionEvaluator,

View File

@@ -3,7 +3,7 @@ package jobparser
import (
"github.com/nektos/act/pkg/exprparser"
"github.com/nektos/act/pkg/model"
"gopkg.in/yaml.v3"
"go.yaml.in/yaml/v4"
)
// NewInterpeter returns an interpeter used in the server,

View File

@@ -6,7 +6,7 @@ import (
"sort"
"strings"
"gopkg.in/yaml.v3"
"go.yaml.in/yaml/v4"
"github.com/nektos/act/pkg/exprparser"
"github.com/nektos/act/pkg/model"

View File

@@ -8,7 +8,7 @@ import (
"github.com/stretchr/testify/require"
"gopkg.in/yaml.v3"
"go.yaml.in/yaml/v4"
)
func TestParse(t *testing.T) {

View File

@@ -5,7 +5,7 @@ import (
"fmt"
"github.com/nektos/act/pkg/model"
"gopkg.in/yaml.v3"
"go.yaml.in/yaml/v4"
)
// SingleWorkflow is a workflow with single job and single matrix
@@ -50,18 +50,17 @@ func (w *SingleWorkflow) SetJob(id string, job *Job) error {
m := map[string]*Job{
id: job,
}
var buf bytes.Buffer
encoder := yaml.NewEncoder(&buf)
encoder.SetIndent(2)
encoder.Encode(m)
encoder.Close()
buf, err := yaml.Marshal(m)
if err != nil {
return err
}
node := yaml.Node{}
if err := yaml.Unmarshal(buf.Bytes(), &node); err != nil {
if err := yaml.Unmarshal(buf, &node); err != nil {
return err
}
if len(node.Content) != 1 || node.Content[0].Kind != yaml.MappingNode {
return fmt.Errorf("can not set job: %s", buf.String())
return fmt.Errorf("can not set job: %s", string(buf))
}
w.RawJobs = *node.Content[0]
return nil

View File

@@ -9,7 +9,7 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"gopkg.in/yaml.v3"
"go.yaml.in/yaml/v4"
)
func TestParseRawOn(t *testing.T) {

View File

@@ -5,7 +5,7 @@ import (
"io"
"strings"
"gopkg.in/yaml.v3"
"go.yaml.in/yaml/v4"
)
// ActionRunsUsing is the type of runner for the action

View File

@@ -10,7 +10,7 @@ import (
"strings"
log "github.com/sirupsen/logrus"
"gopkg.in/yaml.v3"
"go.yaml.in/yaml/v4"
"github.com/nektos/act/pkg/common"
)

View File

@@ -16,7 +16,7 @@ import (
"github.com/nektos/act/pkg/container"
"github.com/nektos/act/pkg/exprparser"
"github.com/nektos/act/pkg/model"
"gopkg.in/yaml.v3"
"go.yaml.in/yaml/v4"
)
// ExpressionEvaluator is the interface for evaluating expressions

View File

@@ -11,7 +11,7 @@ import (
"github.com/nektos/act/pkg/exprparser"
"github.com/nektos/act/pkg/model"
assert "github.com/stretchr/testify/assert"
yaml "gopkg.in/yaml.v3"
yaml "go.yaml.in/yaml/v4"
)
func createRunContext(t *testing.T) *RunContext {

View File

@@ -15,7 +15,7 @@ import (
log "github.com/sirupsen/logrus"
assert "github.com/stretchr/testify/assert"
yaml "gopkg.in/yaml.v3"
yaml "go.yaml.in/yaml/v4"
)
func TestRunContext_EvalBool(t *testing.T) {

View File

@@ -15,7 +15,7 @@ import (
"github.com/joho/godotenv"
log "github.com/sirupsen/logrus"
assert "github.com/stretchr/testify/assert"
"gopkg.in/yaml.v3"
"go.yaml.in/yaml/v4"
"github.com/nektos/act/pkg/common"
"github.com/nektos/act/pkg/model"

View File

@@ -12,7 +12,7 @@ import (
"github.com/nektos/act/pkg/model"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"
"gopkg.in/yaml.v3"
"go.yaml.in/yaml/v4"
)
type stepActionLocalMocks struct {

View File

@@ -10,7 +10,7 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"
"gopkg.in/yaml.v3"
"go.yaml.in/yaml/v4"
"github.com/nektos/act/pkg/common"
"github.com/nektos/act/pkg/common/git"

View File

@@ -9,7 +9,7 @@ import (
log "github.com/sirupsen/logrus"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"
yaml "gopkg.in/yaml.v3"
yaml "go.yaml.in/yaml/v4"
)
func TestMergeIntoMap(t *testing.T) {