Skip to content

Commit

Permalink
internal/ci: add workflowDispatch step template
Browse files Browse the repository at this point in the history
This resurrects the workflowDispatch step template that was previously
removed in https://cuelang.org/cl/1196926, so that it can be used by a
follow-up.

Signed-off-by: Jonathan Matthews <[email protected]>
Change-Id: I3ebe09cc0a8b594e33faeb5ad8bad6f0022c2a8e
Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1201006
Reviewed-by: Paul Jolly <[email protected]>
TryBot-Result: CUEcueckoo <[email protected]>
  • Loading branch information
jpluscplusm authored and mvdan committed Sep 12, 2024
1 parent 143be90 commit dcfca1b
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions internal/ci/base/github.cue
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,24 @@ repositoryDispatch: json.#step & {
"""#
}

workflowDispatch: json.#step & {
#githubRepositoryPath: *githubRepositoryPath | string
#botGitHubUserTokenSecretsKey: *botGitHubUserTokenSecretsKey | string
#workflowID: string

// params are defined per https://docs.github.com/en/rest/actions/workflows?apiVersion=2022-11-28#create-a-workflow-dispatch-event
#params: *{
ref: defaultBranch
} | _

_curlGitHubAPI: curlGitHubAPI & {#tokenSecretsKey: #botGitHubUserTokenSecretsKey, _}

name: string
run: #"""
\#(_curlGitHubAPI) --fail --request POST --data-binary \#(strconv.Quote(encjson.Marshal(#params))) https://api.github.com/repos/\#(#githubRepositoryPath)/actions/workflows/\#(#workflowID)/dispatches
"""#
}

// dispatchTrailer is the trailer that we use to pass information in a commit
// when triggering workflow events in other GitHub repos.
//
Expand Down

0 comments on commit dcfca1b

Please sign in to comment.