MCPcopy Create free account
hub / github.com/cli/cli / cancelWorkflowRun

Function cancelWorkflowRun

pkg/cmd/run/cancel/cancel.go:143–161  ·  view source on GitHub ↗
(client *api.Client, repo ghrepo.Interface, runID string, force bool)

Source from the content-addressed store, hash-verified

141}
142
143func cancelWorkflowRun(client *api.Client, repo ghrepo.Interface, runID string, force bool) error {
144 var path *safeurl.MutableSafeURL
145 var err error
146 if force {
147 path, err = safeurl.JoinPath("repos", repo.RepoOwner(), repo.RepoName(), "actions", "runs", runID, "force-cancel")
148 } else {
149 path, err = safeurl.JoinPath("repos", repo.RepoOwner(), repo.RepoName(), "actions", "runs", runID, "cancel")
150 }
151 if err != nil {
152 return err
153 }
154
155 err = client.REST(repo.RepoHost(), "POST", path.String(), nil, nil)
156 if err != nil {
157 return err
158 }
159
160 return nil
161}

Callers 1

runCancelFunction · 0.85

Calls 6

StringMethod · 0.95
JoinPathFunction · 0.92
RepoOwnerMethod · 0.65
RepoNameMethod · 0.65
RESTMethod · 0.65
RepoHostMethod · 0.65

Tested by

no test coverage detected