Skip to content

Commit

Permalink
add disable/enable workflow endpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
Eric Vergnaud committed May 27, 2024
1 parent 88d1d5e commit ba9474f
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions go-libs/github/github.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit ba9474f

Please sign in to comment.