fix(actions): keep folded block scalars intact across serialization (#39787) (#39817)

Backport https://github.com/go-gitea/gitea/pull/39787 by @lunny,
including the go-yaml bump. The runner counterpart is
https://gitea.com/gitea/runner/pulls/1321.

Folded (`>`) scalars in workflows gained blank lines and had spaces
turned into newlines every time Gitea re-serialized a job.

- go-yaml main fixes the accumulating blank lines
(https://github.com/yaml/go-yaml/pull/366) and the block scalar
indentation indicators (https://github.com/yaml/go-yaml/pull/414), so
`BlockSafeString` goes away
- The job encoder no longer wraps lines, because go-yaml still wraps
more-indented lines of folded scalars and turns a space into a newline

Fixes https://github.com/go-gitea/gitea/issues/39775
This commit is contained in:
silverwind authored and GitHub committed 2026-10-17 03:15:42 +00:00
1 parent ce8912c8ff
commit 5251cd572f
7 files changed
+72 -59

No files matched your search

+1 -1
View File
@@ -94,7 +94,7 @@ require (
github.com/yuin/goldmark v1.8.6
github.com/yuin/goldmark-highlighting/v2 v2.0.0-20230729083705-37449abec8cc
gitlab.com/gitlab-org/api/client-go/v3 v3.13.0
go.yaml.in/yaml/v4 v4.0.0-rc.6
go.yaml.in/yaml/v4 v4.0.0-rc.6.0.20261013184558-04dd63131525
golang.org/x/crypto v0.57.0
golang.org/x/image v0.46.0
golang.org/x/mod v0.41.0