github

package
v3.2.1 Latest Latest
Warning

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

Go to latest
Published: May 18, 2026 License: AGPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Artifact

type Artifact struct {
	ID                 int64     `json:"id"`
	NodeID             string    `json:"node_id"`
	Name               string    `json:"name"`
	SizeInBytes        int64     `json:"size_in_bytes"`
	URL                string    `json:"url"`
	ArchiveDownloadURL string    `json:"archive_download_url"`
	Expired            bool      `json:"expired"`
	CreatedAt          time.Time `json:"created_at"`
	UpdatedAt          time.Time `json:"updated_at"`
	ExpiresAt          time.Time `json:"expires_at"`
}

Artifact represents a GitHub Actions artifact

type ArtifactCollector

type ArtifactCollector struct {
	// contains filtered or unexported fields
}

ArtifactCollector handles collection of GitHub Actions artifacts

func NewArtifactCollector

func NewArtifactCollector(token, apiURL, repository, runID string) *ArtifactCollector

NewArtifactCollector creates a new artifact collector

func (*ArtifactCollector) DownloadArtifact

func (c *ArtifactCollector) DownloadArtifact(ctx context.Context, artifact Artifact) (string, error)

DownloadArtifact downloads an artifact and extracts it to a temporary directory

func (*ArtifactCollector) ListArtifacts

func (c *ArtifactCollector) ListArtifacts(ctx context.Context) ([]Artifact, error)

ListArtifacts lists all artifacts for the current workflow run

type ArtifactMetadata

type ArtifactMetadata struct {
	Repository      string            `json:"repository"`
	RepositoryOwner string            `json:"repository_owner"`
	RunID           string            `json:"run_id"`
	RunNumber       string            `json:"run_number"`
	WorkflowName    string            `json:"workflow_name"`
	JobName         string            `json:"job"`
	SHA             string            `json:"sha"`
	RefName         string            `json:"ref_name"`
	RefType         string            `json:"ref_type"`
	EventName       string            `json:"event_name"`
	Actor           string            `json:"actor"`
	ServerURL       string            `json:"server_url"`
	APIURL          string            `json:"api_url"`
	Artifacts       []string          `json:"artifacts"`
	ExtraEnvVars    map[string]string `json:"extra_env_vars,omitempty"`
}

ArtifactMetadata contains metadata about the workflow and artifacts

func CollectMetadata

func CollectMetadata(artifactNames []string) *ArtifactMetadata

CollectMetadata collects metadata from GitHub Actions environment

type ArtifactStatusDetail

type ArtifactStatusDetail struct {
	UUID      string `json:"uuid"`
	Name      string `json:"name"`
	Status    string `json:"status"`
	QueuePath string `json:"queue_path,omitempty"`
	Error     string `json:"error,omitempty"`
}

ArtifactStatusDetail represents the status of an individual artifact

type ArtifactUploadResponse

type ArtifactUploadResponse struct {
	UUID      string `json:"uuid"`
	QueuePath string `json:"queue_path"`
	Success   bool   `json:"success"`
	Message   string `json:"message,omitempty"`
}

ArtifactUploadResponse represents the response from artifact upload

type ArtifactUploader

type ArtifactUploader struct {
	// contains filtered or unexported fields
}

ArtifactUploader handles uploading artifacts to Vulnetix API

func NewArtifactUploader

func NewArtifactUploader(baseURL, orgID string) *ArtifactUploader

NewArtifactUploader creates a new artifact uploader using centralized auth

func (*ArtifactUploader) GetArtifactStatus

func (u *ArtifactUploader) GetArtifactStatus(artifactUUID string) (*StatusResponse, error)

GetArtifactStatus retrieves the status of a specific artifact by UUID

func (*ArtifactUploader) GetTransactionStatus

func (u *ArtifactUploader) GetTransactionStatus(txnID string) (*StatusResponse, error)

GetTransactionStatus retrieves the status of a transaction

func (*ArtifactUploader) InitiateTransaction

func (u *ArtifactUploader) InitiateTransaction(metadata *ArtifactMetadata, artifactNames []string) (*TransactionResponse, error)

InitiateTransaction initiates a new artifact upload transaction

func (*ArtifactUploader) UploadArtifact

func (u *ArtifactUploader) UploadArtifact(txnID, artifactName, artifactDir string) (*ArtifactUploadResponse, error)

UploadArtifact uploads a single artifact file to the specified transaction

type ArtifactsResponse

type ArtifactsResponse struct {
	TotalCount int        `json:"total_count"`
	Artifacts  []Artifact `json:"artifacts"`
}

ArtifactsResponse represents the GitHub API response for artifacts

type StatusResponse

type StatusResponse struct {
	Status    string                 `json:"status"`
	TxnID     string                 `json:"txnid,omitempty"`
	Artifacts []ArtifactStatusDetail `json:"artifacts,omitempty"`
	Message   string                 `json:"message,omitempty"`
	Details   map[string]interface{} `json:"details,omitempty"`
}

StatusResponse represents the status check response

type TransactionRequest

type TransactionRequest struct {
	Meta      *ArtifactMetadata `json:"_meta"`
	Artifacts []string          `json:"artifacts"`
}

TransactionRequest represents the initial transaction creation request

type TransactionResponse

type TransactionResponse struct {
	TxnID   string `json:"txnid"`
	Success bool   `json:"success"`
	Message string `json:"message,omitempty"`
}

TransactionResponse represents the response from transaction creation

Jump to

Keyboard shortcuts

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