github

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 22, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteWorkflowRun

func DeleteWorkflowRun(ctx context.Context, client *github.Client, runID int64, repo Repository, workflow Workflow) error

DeleteWorkflowRun deletes a specified GitHub Actions workflow run.

Parameters:

  • ctx: The context for the request.
  • client: The GitHub client to use for making the request.
  • runID: The ID of the workflow run to delete.
  • repo: The repository information containing the owner and repository name.

Returns:

  • error: An error if the deletion fails, otherwise nil.

func DeleteWorkflowRuns

func DeleteWorkflowRuns(ctx context.Context, client *github.Client, repo Repository, workflows []Workflow, maxWorkers int) error

DeleteWorkflowRuns deletes multiple workflow runs concurrently for a given repository. It uses a worker pool to limit the number of concurrent deletions.

Parameters:

  • ctx: The context for the API requests.
  • client: A GitHub client to interact with the GitHub API.
  • repo: The repository containing the workflow runs to be deleted.
  • workflows: A slice of Workflow objects, each containing the IDs of the runs to be deleted.
  • maxWorkers: The maximum number of concurrent deletions.

Returns:

  • error: An error if any of the deletions fail, or nil if all deletions succeed.

func GetAllWorkflowRunIDs

func GetAllWorkflowRunIDs(ctx context.Context, client *github.Client, repo Repository, workflows []Workflow) error

It performs the retrieval concurrently for each workflow and collects any errors encountered.

Parameters:

  • ctx: The context to control cancellation and timeouts.
  • client: The GitHub client used to make API requests.
  • repo: The repository containing the workflows.
  • workflows: A slice of Workflow objects for which to retrieve run IDs.

Returns:

  • error: An error if any of the workflow run ID retrievals fail, otherwise nil.

func GetWorkflowRunIDs

func GetWorkflowRunIDs(ctx context.Context, client *github.Client, workflow Workflow, repo Repository) ([]int64, error)

GetWorkflowRunIDs retrieves the IDs of all workflow runs for a specified workflow and repository.

Parameters:

  • ctx: The context for the request, used for cancellation and timeouts.
  • client: The GitHub client used to interact with the GitHub API.
  • workflow: The workflow for which to retrieve run IDs.
  • repo: The repository containing the workflow.

Returns:

  • A slice of int64 containing the IDs of the workflow runs.
  • An error if the request to the GitHub API fails or if there are issues processing the response.

Types

type Repository

type Repository struct {
	Owner      string
	Repository string
}

Repository represents a GitHub repository with owner and repository name.

type Workflow

type Workflow struct {
	ID   int64
	Name string
	Runs []int64
}

Workflow represents a GitHub Actions workflow with ID, Name, and a slice of run IDs.

func GetWorkflows

func GetWorkflows(ctx context.Context, client *github.Client, repo Repository) ([]Workflow, error)

GetWorkflows retrieves all workflows for a given repository using the provided GitHub client. It returns a slice of Workflow objects containing the ID and Name of each workflow.

Parameters:

  • ctx: The context for the request.
  • client: The GitHub client used to make API requests.
  • repo: The repository information including owner and repository name.

Returns:

  • []Workflow: A slice of Workflow objects containing the ID and Name of each workflow.
  • error: An error if the request fails, otherwise nil.

func GetWorkflowsByName

func GetWorkflowsByName(ctx context.Context, client *github.Client, repo Repository, workflow string) ([]Workflow, error)

GetWorkflowsByName retrieves workflows from a GitHub repository by their name. If the specified workflow name is "all", it returns all workflows.

Parameters:

  • ctx: The context for the request.
  • client: The GitHub client to use for making API requests.
  • repo: The repository from which to retrieve workflows.
  • workflow: The name of the workflow to filter by. If "all", returns all workflows.

Returns:

  • A slice of Workflow objects.
  • An error if there was an issue retrieving the workflows.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL