From ba9474f31777bdcec457d84c4a427003a18247d2 Mon Sep 17 00:00:00 2001 From: Eric Vergnaud Date: Mon, 27 May 2024 17:35:04 +0200 Subject: [PATCH] add disable/enable workflow endpoints --- go-libs/github/github.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/go-libs/github/github.go b/go-libs/github/github.go index c075218..c375593 100644 --- a/go-libs/github/github.go +++ b/go-libs/github/github.go @@ -195,6 +195,18 @@ func (c *GitHubClient) ListRuns(ctx context.Context, org, repo, workflow string) }) } +func (c *GitHubClient) DisableWorkflow(ctx context.Context, org, repo, workflow string) listing.Iterator[workflowRun] { + path := fmt.Sprintf("%s/repos/%s/%s/actions/workflows/%s/disable", gitHubAPI, org, repo, workflow) + err := c.api.Do(ctx, "PUT", path, httpclient) + return err +} + +func (c *GitHubClient) EnableWorkflow(ctx context.Context, org, repo, workflow string) listing.Iterator[workflowRun] { + path := fmt.Sprintf("%s/repos/%s/%s/actions/workflows/%s/enable", gitHubAPI, org, repo, workflow) + err := c.api.Do(ctx, "PUT", path, httpclient) + return err +} + func (c *GitHubClient) ListWorkflowJobs(ctx context.Context, org, repo string, runID int64) listing.Iterator[WorkflowJob] { path := fmt.Sprintf("%s/repos/%s/%s/actions/runs/%v/jobs", gitHubAPI, org, repo, runID) return rawPaginator[WorkflowJob, Jobs, int64](ctx, c, path, &PageOptions{}, func(j Jobs) []WorkflowJob {