(client *api.Client, repo ghrepo.Interface, runID string, force bool)
| 142 | } |
| 143 | |
| 144 | func cancelWorkflowRun(client *api.Client, repo ghrepo.Interface, runID string, force bool) error { |
| 145 | var path string |
| 146 | if force { |
| 147 | path = fmt.Sprintf("repos/%s/actions/runs/%s/force-cancel", ghrepo.FullName(repo), runID) |
| 148 | } else { |
| 149 | path = fmt.Sprintf("repos/%s/actions/runs/%s/cancel", ghrepo.FullName(repo), runID) |
| 150 | } |
| 151 | |
| 152 | err := client.REST(repo.RepoHost(), "POST", path, nil, nil) |
| 153 | if err != nil { |
| 154 | return err |
| 155 | } |
| 156 | |
| 157 | return nil |
| 158 | } |