@@ -3,20 +3,20 @@ package base
3
3
// This file contains aspects principally related to GitHub workflows
4
4
5
5
import (
6
- encjson " encoding/json "
6
+ " encoding/json "
7
7
" list "
8
8
" strings "
9
9
" strconv "
10
10
11
- " github.com/SchemaStore/schemastore/src/schemas/json "
11
+ " github.com/cue-tmp/jsonschema-pub/exp1/githubactions "
12
12
)
13
13
14
- bashWorkflow : json .#Workflow & {
14
+ bashWorkflow : githubactions .#Workflow & {
15
15
jobs : [string ]: defaults : run : shell : " bash "
16
16
}
17
17
18
18
installGo : {
19
- #setupGo : json . #step & {
19
+ #setupGo : githubactions . #Step & {
20
20
name : " Install Go "
21
21
uses : " actions/setup-go@v5 "
22
22
with : {
@@ -49,7 +49,7 @@ installGo: {
49
49
#setupGo ,
50
50
51
51
{
52
- json . #step & {
52
+ githubactions . #Step & {
53
53
name : " Set common go env vars "
54
54
run : """
55
55
go env -w GOTOOLCHAIN=local
@@ -63,7 +63,7 @@ installGo: {
63
63
}
64
64
65
65
checkoutCode : {
66
- #actionsCheckout : json . #step & {
66
+ #actionsCheckout : githubactions . #Step & {
67
67
name : " Checkout code "
68
68
uses : " actions/checkout@v4 "
69
69
@@ -90,17 +90,17 @@ checkoutCode: {
90
90
// per the bug report at https://github.com/MestreLion/git-tools/issues/47,
91
91
// so we first reset all directory timestamps to a static time as a fallback.
92
92
// TODO(mvdan): May be unnecessary once the Go bug above is fixed.
93
- json . #step & {
93
+ githubactions . #Step & {
94
94
name : " Reset git directory modification times "
95
95
run : " touch -t 202211302355 $(find * -type d) "
96
96
},
97
- json . #step & {
97
+ githubactions . #Step & {
98
98
name : " Restore git file modification times "
99
99
uses : " chetan/git-restore-mtime-action@075f9bc9d159805603419d50f794bd9f33252ebe "
100
100
},
101
101
102
102
{
103
- json . #step & {
103
+ githubactions . #Step & {
104
104
name : " Try to extract \(dispatchTrailer ) "
105
105
id : dispatchTrailerStepID
106
106
run : """
@@ -124,7 +124,7 @@ checkoutCode: {
124
124
125
125
// Safety nets to flag if we ever have a Dispatch-Trailer slip through the
126
126
// net and make it to master
127
- json . #step & {
127
+ githubactions . #Step & {
128
128
name : " Check we don't have \(dispatchTrailer ) on a protected branch "
129
129
if : " \(isProtectedBranch ) && \(containsDispatchTrailer ) "
130
130
run : """
@@ -135,7 +135,7 @@ checkoutCode: {
135
135
]
136
136
}
137
137
138
- earlyChecks : json . #step & {
138
+ earlyChecks : githubactions . #Step & {
139
139
name : " Early git and code sanity checks "
140
140
run :
* " go run cuelang.org/go/internal/ci/[email protected] " | string
141
141
}
@@ -177,7 +177,7 @@ setupGoActionsCaches: {
177
177
178
178
let cacheRestoreKeys = " \(#os )-\(#goVersion ) "
179
179
180
- let cacheStep = json . #step & {
180
+ let cacheStep = githubactions . #Step & {
181
181
with : {
182
182
path : strings .Join (cacheDirs , " \n " )
183
183
@@ -197,12 +197,12 @@ setupGoActionsCaches: {
197
197
[
198
198
// TODO: once https://github.com/actions/setup-go/issues/54 is fixed,
199
199
// we could use `go env` outputs from the setup-go step.
200
- json . #step & {
200
+ githubactions . #Step & {
201
201
name : " Get go mod cache directory "
202
202
id : goModCacheDirID
203
203
run : #" echo "dir=$(go env GOMODCACHE)" >> ${GITHUB_OUTPUT} "#
204
204
},
205
- json . #step & {
205
+ githubactions . #Step & {
206
206
name : " Get go build/test cache directory "
207
207
id : goCacheDirID
208
208
run : #" echo "dir=$(go env GOCACHE)" >> ${GITHUB_OUTPUT} "#
@@ -240,7 +240,7 @@ setupGoActionsCaches: {
240
240
//
241
241
// Critically we only want to do this in the main repo, not the trybot
242
242
// repo.
243
- json . #step & {
243
+ githubactions . #Step & {
244
244
if : " github.repository == '\(githubRepositoryPath )' && (\(isProtectedBranch ) || github.ref == 'refs/heads/\(testDefaultBranch )') "
245
245
run : " go clean -testcache "
246
246
}
@@ -270,13 +270,13 @@ isReleaseTag: {
270
270
(_matchPattern & {variable : " github.ref " , pattern : " refs/tags/\(releaseTagPattern ) " }).expr
271
271
}
272
272
273
- checkGitClean : json . #step & {
273
+ checkGitClean : githubactions . #Step & {
274
274
name : " Check that git is clean at the end of the job "
275
275
if : " always() "
276
276
run : " test -z \" $(git status --porcelain)\" || (git status; git diff; false) "
277
277
}
278
278
279
- repositoryDispatch : json . #step & {
279
+ repositoryDispatch : githubactions . #Step & {
280
280
#githubRepositoryPath : * githubRepositoryPath | string
281
281
#botGitHubUserTokenSecretsKey : * botGitHubUserTokenSecretsKey | string
282
282
#arg : _
@@ -285,11 +285,11 @@ repositoryDispatch: json.#step & {
285
285
286
286
name : string
287
287
run : #"""
288
- \#(_curlGitHubAPI ) --fail --request POST --data-binary \#(strconv .Quote (encjson .Marshal (#arg )) ) https://api.github.com/repos/\#(#githubRepositoryPath )/dispatches
288
+ \#(_curlGitHubAPI ) --fail --request POST --data-binary \#(strconv .Quote (json .Marshal (#arg )) ) https://api.github.com/repos/\#(#githubRepositoryPath )/dispatches
289
289
"""#
290
290
}
291
291
292
- workflowDispatch : json . #step & {
292
+ workflowDispatch : githubactions . #Step & {
293
293
#githubRepositoryPath : * githubRepositoryPath | string
294
294
#botGitHubUserTokenSecretsKey : * botGitHubUserTokenSecretsKey | string
295
295
#workflowID : string
@@ -303,7 +303,7 @@ workflowDispatch: json.#step & {
303
303
304
304
name : string
305
305
run : #"""
306
- \#(_curlGitHubAPI ) --fail --request POST --data-binary \#(strconv .Quote (encjson .Marshal (#params )) ) https://api.github.com/repos/\#(#githubRepositoryPath )/actions/workflows/\#(#workflowID )/dispatches
306
+ \#(_curlGitHubAPI ) --fail --request POST --data-binary \#(strconv .Quote (json .Marshal (#params )) ) https://api.github.com/repos/\#(#githubRepositoryPath )/actions/workflows/\#(#workflowID )/dispatches
307
307
"""#
308
308
}
309
309
0 commit comments