Skip to content

Commit

Permalink
internal/ci: fix 'hotfix' for GitHub Actions oneof
Browse files Browse the repository at this point in the history
https://cuelang.org/cl/1194548 upgrade this repo to use the latest
version of the GitHub Actions JSON Schema as its source of truth.

That same CL also included a 'hotfix' to deal with the fact that CUE
does not today properly encode the concept of a oneof from JSON Schema.
Discussion on this point is taken up in https://cuelang.org/issue/3165.

However the 'hotfix' incorrectly made steps a regular field as part of a
job. Generally speaking, constraints in a schema should be optional or
required. And in this case it is an optional field because reusable
workflows do not specify steps (and there is a constraint that where
steps are specified there must be at least one).

Fix that by making the hotfix specify the constraint via an optional
field.

Signed-off-by: Paul Jolly <paul@myitcv.io>
Change-Id: I5925aa01e0df3ccf8a54b111314994bc94ddd0e7
Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1195124
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Reviewed-by: Jonathan Matthews <github@hello.jonathanmatthews.com>
TryBot-Result: CUEcueckoo <cueckoo@cuelang.org>
Unity-Result: CUE porcuepine <cue.porcuepine@gmail.com>
  • Loading branch information
myitcv committed May 24, 2024
1 parent 4fe848d commit 927c503
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@ package json

// CUE does not properly encode a JSON Schema oneOf. This will be fixed in
// https://cuelang.org/issue/943, but for now we apply this patch.
#Workflow: jobs: [string]: steps: [...(
//
// See also the discussion in https://cuelang.org/issue/3165 on how oneofs
// could/should be encoded in CUE. https://cuelang.org/issue/943 suggests one
// approach, https://cuelang.org/issue/3165 is a more general exploration of
// the space.
#Workflow: jobs?: [string]: steps?: [...(
{
uses?: _|_
} | {
Expand Down

0 comments on commit 927c503

Please sign in to comment.