Versions in this module Expand all Collapse all v0 v0.0.1 Nov 29, 2026 Changes in this version + const CampaignAlertsMax + const CampaignClosed + const CampaignDescriptionMax + const CampaignNameMax + const CampaignOpen + const DefaultAPIURL + const MaxSARIFUploadBytes + var ErrNoToken = errors.New("no GitHub token found: set GITHUB_TOKEN or run 'gh auth login'") + var ErrRateLimited = errors.New("GitHub API rate limit exhausted") + func APIURL() string + func AdvisoryMarker(hash string) string + func CampaignEnd(t time.Time) string + func CampaignMarker(uuid string) string + func CampaignMarkerOf(description string) string + func CampaignName(name string) string + func DefaultCorrelator() string + func DownloadAsset(ctx context.Context, token string, a ReleaseAsset, destDir string) (string, error) + func EncodeSARIF(sarifJSON []byte) (string, error) + func GitHubPurl(purl string) string + func IsPermission(err error) bool + func IsStatus(err error, statuses ...int) bool + func MarkerOf(description string) string + func RejectedPurl(err error) string + func RepoFromRemote(remote string) string + func ResolveToken() (token, source string, err error) + type APIError struct + Message string + Method string + Path string + Status int + func (e *APIError) Error() string + type AdvisoryPackage struct + Ecosystem string + Name string + type AdvisoryRequest struct + CWEIDs []string + Description string + Severity string + Summary string + Vulnerabilities []AdvisoryVulnerability + type AdvisoryVulnerability struct + Package AdvisoryPackage + type Alert struct + MostRecentInstance struct{ ... } + Number int + Rule struct{ ... } + State string + type Artifact struct + ArchiveDownloadURL string + CreatedAt time.Time + Expired bool + ExpiresAt time.Time + ID int64 + Name string + NodeID string + SizeInBytes int64 + URL string + UpdatedAt time.Time + type ArtifactCollector struct + func NewArtifactCollector(token, apiURL, repository, runID string) *ArtifactCollector + func (c *ArtifactCollector) DownloadArtifact(ctx context.Context, artifact Artifact) (string, error) + func (c *ArtifactCollector) GetRepository(ctx context.Context) (*Repository, error) + func (c *ArtifactCollector) GetWorkflowRun(ctx context.Context) (*WorkflowRun, error) + func (c *ArtifactCollector) ListArtifacts(ctx context.Context) ([]Artifact, error) + func (c *ArtifactCollector) ListPullsForCommit(ctx context.Context, sha string) ([]PullRequestRef, error) + type ArtifactMetadata struct + APIURL string + Actor string + Artifacts []string + EventName string + ExtraEnvVars map[string]string + JobName string + RefName string + RefType string + Repository string + RepositoryOwner string + RunID string + RunNumber string + SHA string + ServerURL string + WorkflowName string + func CollectMetadata(artifactNames []string) *ArtifactMetadata + type ArtifactsResponse struct + Artifacts []Artifact + TotalCount int + type AssetEntry struct + BrowserDownloadURL string + ID int64 + Name string + Size int64 + type Campaign struct + ContactLink string + Description string + EndsAt string + HTMLURL string + Name string + Number int + State string + type CampaignAlerts struct + AlertNumbers []int + RepositoryID int + type CampaignCreate struct + CodeScanningAlerts []CampaignAlerts + ContactLink string + Description string + EndsAt string + GenerateIssues bool + Name string + type CampaignPatch struct + ContactLink string + Description string + EndsAt string + Name string + State string + type Client struct + BaseURL string + Calls int + HTTP *http.Client + MaxWait time.Duration + Token string + func NewClient(token string) *Client + func (c *Client) CreateAdvisory(ctx context.Context, repo string, req AdvisoryRequest) (*RepositoryAdvisory, error) + func (c *Client) CreateCampaign(ctx context.Context, org string, req CampaignCreate) (*Campaign, error) + func (c *Client) Do(ctx context.Context, method, path string, body, out any) (http.Header, error) + func (c *Client) EnsureRelease(ctx context.Context, repo, tag string, create bool) (*ReleaseInfo, bool, error) + func (c *Client) GetAll(ctx context.Context, path string, out any) error + func (c *Client) ListAdvisories(ctx context.Context, repo string) ([]RepositoryAdvisory, error) + func (c *Client) ListCampaigns(ctx context.Context, org string) ([]Campaign, error) + func (c *Client) ListOpenAlerts(ctx context.Context, repo string) ([]Alert, error) + func (c *Client) PatchCampaign(ctx context.Context, org string, number int, req CampaignPatch) (*Campaign, error) + func (c *Client) RepositoryID(ctx context.Context, repo string) (int, error) + func (c *Client) SubmitSnapshot(ctx context.Context, repo string, s *Snapshot) (*SnapshotResult, error) + func (c *Client) SubmitSnapshotLenient(ctx context.Context, repo string, s *Snapshot) (*SnapshotResult, []string, error) + func (c *Client) UpdateAdvisory(ctx context.Context, repo, ghsaID string, req AdvisoryRequest) (*RepositoryAdvisory, error) + func (c *Client) UploadAsset(ctx context.Context, repo string, rel *ReleaseInfo, path, name string, ...) (*AssetEntry, error) + func (c *Client) UploadSARIF(ctx context.Context, t Target, sarifJSON []byte, checkoutURI string) (*SARIFUpload, error) + func (c *Client) WaitSARIF(ctx context.Context, repo, id string, timeout, interval time.Duration) (*SARIFUpload, error) + type Manifest struct + File *ManifestFile + Name string + Resolved map[string]ResolvedPackage + type ManifestFile struct + SourceLocation string + type PullRequestRef struct + Base struct{ ... } + Head struct{ ... } + Number int + State string + type Release struct + Assets []ReleaseAsset + TagName string + func FetchReleaseByTag(ctx context.Context, token, apiURL, repository, tag string) (*Release, error) + func (r *Release) AssetMatching(substr string) *ReleaseAsset + type ReleaseAsset struct + BrowserDownloadURL string + Name string + type ReleaseInfo struct + Assets []AssetEntry + Draft bool + HTMLURL string + ID int64 + TagName string + UploadURL string + type Repository struct + DefaultBranch string + FullName string + ID int64 + License ... + Owner *User + Private bool + Visibility string + type RepositoryAdvisory struct + Description string + GHSAID string + HTMLURL string + State string + Summary string + type ResolvedPackage struct + Dependencies []string + PackageURL string + Relationship string + Scope string + type SARIFUpload struct + AnalysesURL string + Errors []string + ID string + ProcessingStatus string + URL string + type Snapshot struct + Detector SnapshotDetector + Job SnapshotJob + Manifests map[string]Manifest + Ref string + SHA string + Scanned string + Version int + func BuildSnapshot(cdxJSON []byte, o SnapshotOptions) (*Snapshot, error) + func (s *Snapshot) Drop(purl string) bool + func (s *Snapshot) ManifestCount() int + func (s *Snapshot) PackageCount() int + type SnapshotDetector struct + Name string + URL string + Version string + type SnapshotJob struct + Correlator string + HTMLURL string + ID string + type SnapshotOptions struct + Correlator string + DefaultManifest string + DetectorVersion string + JobID string + JobURL string + Now time.Time + Target Target + type SnapshotResult struct + CreatedAt string + ID int64 + Message string + Result string + type Target struct + Ref string + Repo string + SHA string + func ResolveTarget(dir, repo, sha, ref string) (Target, error) + func (t Target) Name() string + func (t Target) Owner() string + type User struct + Login string + Type string + type WorkflowRun struct + Actor *User + Conclusion string + Event string + HTMLURL string + HeadBranch string + HeadSHA string + ID int64 + Name string + Path string + PullRequests []struct{ ... } + RunAttempt int + RunNumber int + Status string + TriggeringActor *User