From a13533df6f658f52860f0b07bd918d1be1d08ffd Mon Sep 17 00:00:00 2001 From: Deimantas Tumas Date: Tue, 5 Oct 2021 13:58:46 +0300 Subject: [PATCH 1/2] Improve the ordering of GHA workflow fields --- octo/actions/workflow.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/octo/actions/workflow.go b/octo/actions/workflow.go index 72bac7bb..3d2873e9 100644 --- a/octo/actions/workflow.go +++ b/octo/actions/workflow.go @@ -30,12 +30,12 @@ type Workflow struct { type Job struct { Name string `yaml:",omitempty"` + If string `yaml:",omitempty"` Needs []string `yaml:",omitempty"` RunsOn []VirtualEnvironment `yaml:"runs-on,omitempty"` Outputs map[string]string `yaml:",omitempty"` Env map[string]string `yaml:",omitempty"` Defaults Defaults `yaml:",omitempty"` - If string `yaml:",omitempty"` Steps []Step `yaml:",omitempty"` TimeoutMinutes int `yaml:",omitempty"` Strategy Strategy `yaml:",omitempty"` @@ -50,9 +50,9 @@ type Run struct { } type Step struct { - Id string `yaml:",omitempty"` - If string `yaml:",omitempty"` Name string `yaml:",omitempty"` + If string `yaml:",omitempty"` + Id string `yaml:",omitempty"` Uses string `yaml:",omitempty"` Run string `yaml:",omitempty"` WorkingDirectory string `yaml:"working-directory,omitempty"` From 558c8f45a7ca1940d0a0e3a0b813e6542c96aaf4 Mon Sep 17 00:00:00 2001 From: Deimantas Tumas Date: Tue, 5 Oct 2021 15:46:17 +0300 Subject: [PATCH 2/2] Explain the struct fields ordering --- octo/actions/workflow.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/octo/actions/workflow.go b/octo/actions/workflow.go index 3d2873e9..da7225c9 100644 --- a/octo/actions/workflow.go +++ b/octo/actions/workflow.go @@ -28,6 +28,8 @@ type Workflow struct { Jobs map[string]Job `yaml:",omitempty"` } +// The ordering of the struct fields is intentional for better YAML readability after the marshalling +// Read more: https://github.com/paketo-buildpacks/pipeline-builder/pull/399 type Job struct { Name string `yaml:",omitempty"` If string `yaml:",omitempty"`