ci: add -f (fail) flag to curl calls in GitHub Actions trigger

If any of the curl callbacks to the Gerrit instance (e.g. notifying the
start of a runtrybot-triggered build, failure or success) themselves
fail we need to fail the build.

Therefore we use the -f (fail) flag to curl, so that if any of these
callbacks do fail, the curl command will fail, which will fail the build
(as expected).

Also fix the version of the JSON schema definition we are using for
GitHub workflows.

Regenerate to fix stale files.

Change-Id: I6ecee5c78b2f557adf4912c4bad2d394bc0b5931
Reviewed-on: https://cue-review.googlesource.com/c/cue/+/6040
Reviewed-by: Paul Jolly <paul@myitcv.org.uk>
diff --git a/.github/workflows/rebuild_tip_cuelang_org.yml b/.github/workflows/rebuild_tip_cuelang_org.yml
index db5c112..97ce237 100644
--- a/.github/workflows/rebuild_tip_cuelang_org.yml
+++ b/.github/workflows/rebuild_tip_cuelang_org.yml
@@ -10,5 +10,5 @@
     runs-on: ubuntu-latest
     steps:
     - name: Rebuild tip.cuelang.org
-      run: curl -X POST -d {} https://api.netlify.com/build_hooks/${{ secrets.CuelangOrgTipRebuildHook
+      run: curl -f -X POST -d {} https://api.netlify.com/build_hooks/${{ secrets.CuelangOrgTipRebuildHook
         }}
diff --git a/.github/workflows/test_dispatch.yml b/.github/workflows/test_dispatch.yml
index ed30610..9f6aaf4 100644
--- a/.github/workflows/test_dispatch.yml
+++ b/.github/workflows/test_dispatch.yml
@@ -47,7 +47,7 @@
       run: test -z "$(git status --porcelain)" || (git status; git diff; false)
     - name: Post any failures for this matrix entry
       if: ${{ failure() }}
-      run: 'curl -s -H "Content-Type: application/json" --request POST --data ''{"labels":
+      run: 'curl -f -s -H "Content-Type: application/json" --request POST --data ''{"labels":
         { "Code-Review": -1 }, "message":"Build failed for ${{ runner.os }}-${{ matrix.go-version
         }}; see ${{ github.event.repository.html_url }}/actions/runs/${{ github.run_id
         }} for more details"}'' -b ~/.gitcookies https://cue-review.googlesource.com/a/changes/${{
@@ -69,7 +69,7 @@
     - name: Write the gitcookies file
       run: echo "$GERRIT_COOKIE" > ~/.gitcookies
     - name: Update Gerrit CL message with starting message
-      run: 'curl -s -H "Content-Type: application/json" --request POST --data ''{"message":"Started
+      run: 'curl -f -s -H "Content-Type: application/json" --request POST --data ''{"message":"Started
         the build... see progress at ${{ github.event.repository.html_url }}/actions/runs/${{
         github.run_id }}"}'' -b ~/.gitcookies https://cue-review.googlesource.com/a/changes/${{
         github.event.client_payload.changeID }}/revisions/${{ github.event.client_payload.commit
@@ -81,7 +81,7 @@
     - name: Write the gitcookies file
       run: echo "$GERRIT_COOKIE" > ~/.gitcookies
     - name: Update Gerrit CL message with success message
-      run: 'curl -s -H "Content-Type: application/json" --request POST --data ''{"labels":
+      run: 'curl -f -s -H "Content-Type: application/json" --request POST --data ''{"labels":
         { "Code-Review": 1 }, "message":"Build succeeded for ${{ github.event.repository.html_url
         }}/actions/runs/${{ github.run_id }}"}'' -b ~/.gitcookies https://cue-review.googlesource.com/a/changes/${{
         github.event.client_payload.changeID }}/revisions/${{ github.event.client_payload.commit
diff --git a/cue.mod/pkg/github.com/SchemaStore/schemastore/schemas/json/github-workflow.cue b/cue.mod/pkg/github.com/SchemaStore/schemastore/schemas/json/github-workflow.cue
index b4edd2d..f9629b5 100644
--- a/cue.mod/pkg/github.com/SchemaStore/schemastore/schemas/json/github-workflow.cue
+++ b/cue.mod/pkg/github.com/SchemaStore/schemastore/schemas/json/github-workflow.cue
@@ -376,7 +376,7 @@
 					// Each run keyword represents a new process and shell in the
 					// virtual environment. When you provide multi-line commands,
 					// each line runs in the same shell.
-					run?: string, shell?: #shell, "working-directory"?: #def["working-directory"]
+					run?: string, shell?: #shell, "working-directory"?: #["working-directory"]
 
 					// You can use the if conditional to prevent a step from running
 					// unless a condition is met. You can use any supported context
@@ -547,12 +547,12 @@
 
 	#defaults: run?: {
 		shell?:               #shell
-		"working-directory"?: #def["working-directory"]
+		"working-directory"?: #["working-directory"]
 	}
 
 	#shell: string | ("bash" | "pwsh" | "python" | "sh" | "cmd" | "powershell")
 
-	#def: "working-directory": string
+	#: "working-directory": string
 
 	#event: "check_run" | "check_suite" | "create" | "delete" | "deployment" | "deployment_status" | "fork" | "gollum" | "issue_comment" | "issues" | "label" | "member" | "milestone" | "page_build" | "project" | "project_card" | "project_column" | "public" | "pull_request" | "pull_request_review" | "pull_request_review_comment" | "push" | "registry_package" | "release" | "status" | "watch" | "repository_dispatch"
 
diff --git a/internal/ci/ci_tool.cue b/internal/ci/ci_tool.cue
index 90e1143..9c5e2c2 100644
--- a/internal/ci/ci_tool.cue
+++ b/internal/ci/ci_tool.cue
@@ -25,10 +25,10 @@
 command: vendorgithubschema: {
 	get: http.Get & {
 		request: body: ""
-		url: "https://raw.githubusercontent.com/SchemaStore/schemastore/master/src/schemas/json/github-workflow.json"
+		url: "https://raw.githubusercontent.com/SchemaStore/schemastore/f7a0789ccb3bd74a720ddbd6691d60fd9e2d8b7a/src/schemas/json/github-workflow.json"
 	}
 	convert: exec.Run & {
 		stdin: get.response.body
-		cmd: "go run cuelang.org/go/cmd/cue import -f -p json -l Workflow:: jsonschema: - --outfile pkg/github.com/SchemaStore/schemastore/schemas/json/github-workflow.cue"
+		cmd:   "go run cuelang.org/go/cmd/cue import -f -p json -l Workflow:: jsonschema: - --outfile pkg/github.com/SchemaStore/schemastore/schemas/json/github-workflow.cue"
 	}
 }
diff --git a/internal/ci/workflows.cue b/internal/ci/workflows.cue
index 443fc47..9a0ed27 100644
--- a/internal/ci/workflows.cue
+++ b/internal/ci/workflows.cue
@@ -111,7 +111,7 @@
 			}, {
 				name: "Update Gerrit CL message with starting message"
 				run: """
-					curl -s -H \"Content-Type: application/json\" --request POST --data '{\"message\":\"Started the build... see progress at ${{ github.event.repository.html_url }}/actions/runs/${{ github.run_id }}\"}' -b ~/.gitcookies https://cue-review.googlesource.com/a/changes/${{ github.event.client_payload.changeID }}/revisions/${{ github.event.client_payload.commit }}/review
+					curl -f -s -H \"Content-Type: application/json\" --request POST --data '{\"message\":\"Started the build... see progress at ${{ github.event.repository.html_url }}/actions/runs/${{ github.run_id }}\"}' -b ~/.gitcookies https://cue-review.googlesource.com/a/changes/${{ github.event.client_payload.changeID }}/revisions/${{ github.event.client_payload.commit }}/review
 					"""
 			}]
 		}
@@ -167,7 +167,7 @@
 			}, {
 				name: "Post any failures for this matrix entry"
 				run: """
-					curl -s -H \"Content-Type: application/json\" --request POST --data '{\"labels\": { \"Code-Review\": -1 }, \"message\":\"Build failed for ${{ runner.os }}-${{ matrix.go-version }}; see ${{ github.event.repository.html_url }}/actions/runs/${{ github.run_id }} for more details\"}' -b ~/.gitcookies https://cue-review.googlesource.com/a/changes/${{ github.event.client_payload.changeID }}/revisions/${{ github.event.client_payload.commit }}/review
+					curl -f -s -H \"Content-Type: application/json\" --request POST --data '{\"labels\": { \"Code-Review\": -1 }, \"message\":\"Build failed for ${{ runner.os }}-${{ matrix.go-version }}; see ${{ github.event.repository.html_url }}/actions/runs/${{ github.run_id }} for more details\"}' -b ~/.gitcookies https://cue-review.googlesource.com/a/changes/${{ github.event.client_payload.changeID }}/revisions/${{ github.event.client_payload.commit }}/review
 					"""
 				if: "${{ failure() }}"
 			}]
@@ -189,7 +189,7 @@
 			}, {
 				name: "Update Gerrit CL message with success message"
 				run: """
-					curl -s -H \"Content-Type: application/json\" --request POST --data '{\"labels\": { \"Code-Review\": 1 }, \"message\":\"Build succeeded for ${{ github.event.repository.html_url }}/actions/runs/${{ github.run_id }}\"}' -b ~/.gitcookies https://cue-review.googlesource.com/a/changes/${{ github.event.client_payload.changeID }}/revisions/${{ github.event.client_payload.commit }}/review
+					curl -f -s -H \"Content-Type: application/json\" --request POST --data '{\"labels\": { \"Code-Review\": 1 }, \"message\":\"Build succeeded for ${{ github.event.repository.html_url }}/actions/runs/${{ github.run_id }}\"}' -b ~/.gitcookies https://cue-review.googlesource.com/a/changes/${{ github.event.client_payload.changeID }}/revisions/${{ github.event.client_payload.commit }}/review
 					"""
 			}]
 			needs: "test"
@@ -260,7 +260,7 @@
 		"runs-on": "ubuntu-latest"
 		steps: [{
 			name: "Rebuild tip.cuelang.org"
-			run:  "curl -X POST -d {} https://api.netlify.com/build_hooks/${{ secrets.CuelangOrgTipRebuildHook }}"
+			run:  "curl -f -X POST -d {} https://api.netlify.com/build_hooks/${{ secrets.CuelangOrgTipRebuildHook }}"
 		}]
 	}
 }