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

Function cancelWorkflowRun

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

Source from the content-addressed store, hash-verified

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

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