dashboard

package
v0.0.0-...-f2e6f42 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package dashboard provides GitHub dashboard operations for notifications, alerts and issues.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatDashboardSummary

func FormatDashboardSummary(summary *DashboardSummary, detailed bool) string

FormatDashboardSummary formats the dashboard summary as a readable string

Types

type CodeScanningAlert

type CodeScanningAlert struct {
	Number          int       `json:"number"`
	CreatedAt       time.Time `json:"created_at"`
	State           string    `json:"state"`
	HTMLURL         string    `json:"html_url"`
	DismissedAt     *string   `json:"dismissed_at"`
	DismissedReason *string   `json:"dismissed_reason"`
	Rule            struct {
		ID          string `json:"id"`
		Severity    string `json:"severity"`
		Description string `json:"description"`
		Name        string `json:"name"`
	} `json:"rule"`
	Tool struct {
		Name    string `json:"name"`
		Version string `json:"version"`
	} `json:"tool"`
	MostRecentInstance struct {
		Ref      string `json:"ref"`
		State    string `json:"state"`
		Location struct {
			Path      string `json:"path"`
			StartLine int    `json:"start_line"`
			EndLine   int    `json:"end_line"`
		} `json:"location"`
	} `json:"most_recent_instance"`
	Repository *RepositoryInfo `json:"repository,omitempty"`
}

CodeScanningAlert represents a code scanning alert

type DashboardClient

type DashboardClient struct {
	HTTPClient *http.Client
	Token      string
	BaseURL    string
}

DashboardClient provides access to GitHub dashboard APIs

func NewDashboardClient

func NewDashboardClient(token string) *DashboardClient

NewDashboardClient creates a new dashboard client

func (*DashboardClient) GetAssignedIssues

func (d *DashboardClient) GetAssignedIssues(ctx context.Context) ([]Issue, error)

GetAssignedIssues retrieves issues assigned to the authenticated user

func (*DashboardClient) GetCodeScanningAlerts

func (d *DashboardClient) GetCodeScanningAlerts(ctx context.Context, owner, repo string) ([]CodeScanningAlert, error)

GetCodeScanningAlerts retrieves code scanning alerts for a repository

func (*DashboardClient) GetDependabotAlerts

func (d *DashboardClient) GetDependabotAlerts(ctx context.Context, owner, repo string) ([]DependabotAlert, error)

GetDependabotAlerts retrieves Dependabot alerts for a repository

func (*DashboardClient) GetFailedWorkflows

func (d *DashboardClient) GetFailedWorkflows(ctx context.Context, owner, repo string) ([]WorkflowRun, error)

GetFailedWorkflows retrieves failed workflow runs for a repository

func (*DashboardClient) GetFullDashboard

func (d *DashboardClient) GetFullDashboard(ctx context.Context, includeDetails bool) (*DashboardSummary, error)

GetFullDashboard retrieves a complete summary of all GitHub items requiring attention

func (*DashboardClient) GetNotifications

func (d *DashboardClient) GetNotifications(ctx context.Context, all bool) ([]Notification, error)

GetNotifications retrieves all notifications for the authenticated user

func (*DashboardClient) GetPRsToReview

func (d *DashboardClient) GetPRsToReview(ctx context.Context) ([]Issue, error)

GetPRsToReview retrieves PRs where review is requested from the authenticated user

func (*DashboardClient) GetSecretScanningAlerts

func (d *DashboardClient) GetSecretScanningAlerts(ctx context.Context, owner, repo string) ([]SecretScanningAlert, error)

GetSecretScanningAlerts retrieves secret scanning alerts for a repository

func (*DashboardClient) GetUserRepos

func (d *DashboardClient) GetUserRepos(ctx context.Context) ([]RepositoryInfo, error)

GetUserRepos retrieves all repositories for the authenticated user

func (*DashboardClient) MarkAllNotificationsAsRead

func (d *DashboardClient) MarkAllNotificationsAsRead(ctx context.Context) error

MarkAllNotificationsAsRead marks all notifications as read

func (*DashboardClient) MarkNotificationAsRead

func (d *DashboardClient) MarkNotificationAsRead(ctx context.Context, threadID string) error

MarkNotificationAsRead marks a notification thread as read

type DashboardSummary

type DashboardSummary struct {
	Timestamp           time.Time `json:"timestamp"`
	TotalItems          int       `json:"total_items"`
	UnreadNotifications int       `json:"unread_notifications"`
	OpenIssuesAssigned  int       `json:"open_issues_assigned"`
	PendingPRReviews    int       `json:"pending_pr_reviews"`
	DependabotAlerts    int       `json:"dependabot_alerts"`
	SecretAlerts        int       `json:"secret_alerts"`
	CodeScanningAlerts  int       `json:"code_scanning_alerts"`
	FailedWorkflows     int       `json:"failed_workflows"`

	Notifications       []Notification        `json:"notifications,omitempty"`
	Issues              []Issue               `json:"issues,omitempty"`
	PRsToReview         []Issue               `json:"prs_to_review,omitempty"`
	DependabotList      []DependabotAlert     `json:"dependabot_list,omitempty"`
	SecretAlertsList    []SecretScanningAlert `json:"secret_alerts_list,omitempty"`
	CodeAlertsList      []CodeScanningAlert   `json:"code_alerts_list,omitempty"`
	FailedWorkflowsList []WorkflowRun         `json:"failed_workflows_list,omitempty"`
}

DashboardSummary contains a complete summary of all GitHub items requiring attention

type DependabotAlert

type DependabotAlert struct {
	Number                int                   `json:"number"`
	State                 string                `json:"state"`
	CreatedAt             time.Time             `json:"created_at"`
	UpdatedAt             time.Time             `json:"updated_at"`
	HTMLURL               string                `json:"html_url"`
	DismissedAt           *string               `json:"dismissed_at"`
	DismissedReason       *string               `json:"dismissed_reason"`
	DismissedComment      *string               `json:"dismissed_comment"`
	FixedAt               *string               `json:"fixed_at"`
	Dependency            Dependency            `json:"dependency"`
	SecurityAdvisory      SecurityAdvisory      `json:"security_advisory"`
	SecurityVulnerability SecurityVulnerability `json:"security_vulnerability"`
	Repository            *RepositoryInfo       `json:"repository,omitempty"`
}

DependabotAlert represents a Dependabot security alert

type Dependency

type Dependency struct {
	Package struct {
		Ecosystem string `json:"ecosystem"`
		Name      string `json:"name"`
	} `json:"package"`
	ManifestPath string `json:"manifest_path"`
	Scope        string `json:"scope"`
}

Dependency contains package information

type Issue

type Issue struct {
	ID          int64           `json:"id"`
	Number      int             `json:"number"`
	Title       string          `json:"title"`
	State       string          `json:"state"`
	HTMLURL     string          `json:"html_url"`
	CreatedAt   time.Time       `json:"created_at"`
	UpdatedAt   time.Time       `json:"updated_at"`
	Body        string          `json:"body"`
	Labels      []Label         `json:"labels"`
	Assignee    *User           `json:"assignee"`
	Assignees   []User          `json:"assignees"`
	User        User            `json:"user"`
	Comments    int             `json:"comments"`
	Repository  *RepositoryInfo `json:"repository,omitempty"`
	PullRequest *struct {
		URL string `json:"url"`
	} `json:"pull_request,omitempty"`
}

Issue represents a GitHub issue

type Label

type Label struct {
	ID          int64  `json:"id"`
	Name        string `json:"name"`
	Description string `json:"description"`
	Color       string `json:"color"`
}

Label represents a GitHub label

type Notification

type Notification struct {
	ID         string     `json:"id"`
	Unread     bool       `json:"unread"`
	Reason     string     `json:"reason"`
	UpdatedAt  time.Time  `json:"updated_at"`
	LastReadAt *time.Time `json:"last_read_at"`
	Subject    struct {
		Title            string `json:"title"`
		URL              string `json:"url"`
		LatestCommentURL string `json:"latest_comment_url"`
		Type             string `json:"type"`
	} `json:"subject"`
	Repository struct {
		ID       int64  `json:"id"`
		Name     string `json:"name"`
		FullName string `json:"full_name"`
		Private  bool   `json:"private"`
		HTMLURL  string `json:"html_url"`
	} `json:"repository"`
	URL             string `json:"url"`
	SubscriptionURL string `json:"subscription_url"`
}

Notification represents a GitHub notification

type RepositoryInfo

type RepositoryInfo struct {
	ID       int64  `json:"id"`
	Name     string `json:"name"`
	FullName string `json:"full_name"`
	Private  bool   `json:"private"`
	HTMLURL  string `json:"html_url"`
}

RepositoryInfo contains basic repository information

type SecretScanningAlert

type SecretScanningAlert struct {
	Number                int             `json:"number"`
	CreatedAt             time.Time       `json:"created_at"`
	State                 string          `json:"state"`
	SecretType            string          `json:"secret_type"`
	SecretTypeDisplayName string          `json:"secret_type_display_name"`
	HTMLURL               string          `json:"html_url"`
	Resolution            *string         `json:"resolution"`
	ResolvedAt            *string         `json:"resolved_at"`
	Validity              string          `json:"validity"`
	Repository            *RepositoryInfo `json:"repository,omitempty"`
}

SecretScanningAlert represents a secret scanning alert

type SecurityAdvisory

type SecurityAdvisory struct {
	GHSAID      string `json:"ghsa_id"`
	CVEID       string `json:"cve_id"`
	Summary     string `json:"summary"`
	Description string `json:"description"`
	Severity    string `json:"severity"`
	CVSS        struct {
		VectorString string  `json:"vector_string"`
		Score        float64 `json:"score"`
	} `json:"cvss"`
	PublishedAt time.Time `json:"published_at"`
}

SecurityAdvisory contains advisory information

type SecurityVulnerability

type SecurityVulnerability struct {
	Package struct {
		Ecosystem string `json:"ecosystem"`
		Name      string `json:"name"`
	} `json:"package"`
	Severity               string `json:"severity"`
	VulnerableVersionRange string `json:"vulnerable_version_range"`
	FirstPatchedVersion    *struct {
		Identifier string `json:"identifier"`
	} `json:"first_patched_version"`
}

SecurityVulnerability contains vulnerability details

type User

type User struct {
	Login     string `json:"login"`
	ID        int64  `json:"id"`
	AvatarURL string `json:"avatar_url"`
	HTMLURL   string `json:"html_url"`
}

User represents a GitHub user

type WorkflowRun

type WorkflowRun struct {
	ID         int64           `json:"id"`
	Name       string          `json:"name"`
	HeadBranch string          `json:"head_branch"`
	Status     string          `json:"status"`
	Conclusion string          `json:"conclusion"`
	HTMLURL    string          `json:"html_url"`
	CreatedAt  time.Time       `json:"created_at"`
	UpdatedAt  time.Time       `json:"updated_at"`
	RunNumber  int             `json:"run_number"`
	Event      string          `json:"event"`
	Repository *RepositoryInfo `json:"repository,omitempty"`
}

WorkflowRun represents a GitHub Actions workflow run

Jump to

Keyboard shortcuts

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