schemas

package
v1.0.9 Latest Latest
Warning

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

Go to latest
Published: May 18, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package schemas defines Go types for GitHub webhook event payloads as stored in BigQuery.

The Wrapper type wraps any event body with metadata including the delivery timestamp and GitHub webhook headers. Event-specific types such as PullRequest, Repository, User, and Installation mirror the structure of GitHub webhook payloads using BigQuery-compatible field types.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CheckRun added in v0.5.156

type CheckRun struct {
	ID           bigquery.NullInt64     `json:"id,omitempty" bigquery:"id"`
	HeadSHA      bigquery.NullString    `json:"head_sha,omitempty" bigquery:"head_sha"`
	Status       bigquery.NullString    `json:"status,omitempty" bigquery:"status"`
	Conclusion   bigquery.NullString    `json:"conclusion,omitempty" bigquery:"conclusion"`
	StartedAt    bigquery.NullTimestamp `json:"started_at,omitempty" bigquery:"started_at"`
	CompletedAt  bigquery.NullTimestamp `json:"completed_at,omitempty" bigquery:"completed_at"`
	Name         bigquery.NullString    `json:"name,omitempty" bigquery:"name"`
	CheckSuite   *CheckSuite            `json:"check_suite,omitempty" bigquery:"check_suite"`
	PullRequests []PullRequest          `json:"pull_requests,omitempty" bigquery:"pull_requests"`
}

https://pkg.go.dev/github.com/google/go-github/v60/github#CheckRun

type CheckRunEvent added in v0.5.156

type CheckRunEvent struct {
	Action       bigquery.NullString `json:"action,omitempty" bigquery:"action"`
	CheckRun     CheckRun            `json:"check_run,omitempty" bigquery:"check_run"`
	Repository   Repository          `json:"repository,omitempty" bigquery:"repository"`
	Organization Organization        `json:"organization,omitempty" bigquery:"organization"`
	Sender       User                `json:"sender,omitempty" bigquery:"sender"`
	Installation *Installation       `json:"installation,omitempty" bigquery:"installation"`
}

https://pkg.go.dev/github.com/google/go-github/v60/github#CheckRunEvent

type CheckSuite added in v0.5.156

type CheckSuite struct {
	ID           bigquery.NullInt64     `json:"id,omitempty" bigquery:"id"`
	HeadSHA      bigquery.NullString    `json:"head_sha,omitempty" bigquery:"head_sha"`
	Status       bigquery.NullString    `json:"status,omitempty" bigquery:"status"`
	Conclusion   bigquery.NullString    `json:"conclusion,omitempty" bigquery:"conclusion"`
	CreatedAt    bigquery.NullTimestamp `json:"created_at,omitempty" bigquery:"created_at"`
	UpdatedAt    bigquery.NullTimestamp `json:"updated_at,omitempty" bigquery:"updated_at"`
	Repository   Repository             `json:"repository,omitempty" bigquery:"repository"`
	PullRequests []PullRequest          `json:"pull_requests,omitempty" bigquery:"pull_requests"`
}

https://pkg.go.dev/github.com/google/go-github/v60/github#CheckSuite

type CheckSuiteEvent added in v0.5.156

type CheckSuiteEvent struct {
	Action       bigquery.NullString `json:"action,omitempty" bigquery:"action"`
	CheckSuite   *CheckSuite         `json:"check_suite,omitempty" bigquery:"check_suite"`
	Repository   Repository          `json:"repository,omitempty" bigquery:"repository"`
	Organization Organization        `json:"organization,omitempty" bigquery:"organization"`
	Sender       User                `json:"sender,omitempty" bigquery:"sender"`
	Installation *Installation       `json:"installation,omitempty" bigquery:"installation"`
}

https://pkg.go.dev/github.com/google/go-github/v60/github#CheckSuiteEvent

type GitHubHeaders added in v0.5.156

type GitHubHeaders struct {
	HookID                 bigquery.NullString `json:"hook_id,omitempty" bigquery:"hook_id"`
	DeliveryID             bigquery.NullString `json:"delivery_id,omitempty" bigquery:"delivery_id"`
	UserAgent              bigquery.NullString `json:"user_agent,omitempty" bigquery:"user_agent"`
	Event                  bigquery.NullString `json:"event,omitempty" bigquery:"event"`
	InstallationTargetType bigquery.NullString `json:"installation_target_type,omitempty" bigquery:"installation_target_type"`
	InstallationTargetID   bigquery.NullString `json:"installation_target_id,omitempty" bigquery:"installation_target_id"`
}

type Installation added in v0.5.156

type Installation struct {
	// Installation ID
	ID bigquery.NullInt64 `json:"id,omitempty" bigquery:"id"`
	// App ID
	AppID bigquery.NullInt64 `json:"app_id,omitempty" bigquery:"app_id"`
}

https://pkg.go.dev/github.com/google/go-github/v60/github#Installation

type Issue added in v0.5.156

type Issue struct {
	ID                bigquery.NullInt64     `json:"id,omitempty" bigquery:"id"`
	Number            bigquery.NullInt64     `json:"number,omitempty" bigquery:"number"`
	State             bigquery.NullString    `json:"state,omitempty" bigquery:"state"`
	StateReason       bigquery.NullString    `json:"state_reason,omitempty" bigquery:"state_reason"`
	Locked            bigquery.NullBool      `json:"locked,omitempty" bigquery:"locked"`
	Title             bigquery.NullString    `json:"title,omitempty" bigquery:"title"`
	Body              bigquery.NullString    `json:"body,omitempty" bigquery:"body"`
	AuthorAssociation bigquery.NullString    `json:"author_association,omitempty" bigquery:"author_association"`
	User              User                   `json:"user,omitempty" bigquery:"user"`
	Labels            []Label                `json:"labels" bigquery:"labels"`
	Assignee          User                   `json:"assignee,omitempty" bigquery:"assignee"`
	Comments          bigquery.NullInt64     `json:"comments,omitempty" bigquery:"comments"`
	ClosedAt          bigquery.NullTimestamp `json:"closed_at,omitempty" bigquery:"closed_at"`
	CreatedAt         bigquery.NullTimestamp `json:"created_at,omitempty" bigquery:"created_at"`
	UpdatedAt         bigquery.NullTimestamp `json:"updated_at,omitempty" bigquery:"updated_at"`
	ClosedBy          User                   `json:"closed_by,omitempty" bigquery:"closed_by"`
	URL               bigquery.NullString    `json:"url,omitempty" bigquery:"url"`
	HTMLURL           bigquery.NullString    `json:"html_url,omitempty" bigquery:"html_url"`
	CommentsURL       bigquery.NullString    `json:"comments_url,omitempty" bigquery:"comments_url"`
	EventsURL         bigquery.NullString    `json:"events_url,omitempty" bigquery:"events_url"`
	LabelsURL         bigquery.NullString    `json:"labels_url,omitempty" bigquery:"labels_url"`
	RepositoryURL     bigquery.NullString    `json:"repository_url,omitempty" bigquery:"repository_url"`
	PullRequestLinks  PullRequestLinks       `json:"pull_request,omitempty" bigquery:"pull_request"`
	Repository        Repository             `json:"repository,omitempty" bigquery:"repository"`
	Assignees         []User                 `json:"assignees,omitempty" bigquery:"assignees"`
	NodeID            bigquery.NullString    `json:"node_id,omitempty" bigquery:"node_id"`
	Draft             bigquery.NullBool      `json:"draft,omitempty" bigquery:"draft"`
}

https://pkg.go.dev/github.com/google/go-github/v60/github#Issue

type IssueComment added in v0.5.156

type IssueComment struct {
	URL      bigquery.NullString    `json:"url,omitempty" bigquery:"url"`
	HTMLURL  bigquery.NullString    `json:"html_url,omitempty" bigquery:"html_url"`
	DiffURL  bigquery.NullString    `json:"diff_url,omitempty" bigquery:"diff_url"`
	PatchURL bigquery.NullString    `json:"patch_url,omitempty" bigquery:"patch_url"`
	MergedAt bigquery.NullTimestamp `json:"merged_at,omitempty" bigquery:"merged_at"`
}

https://pkg.go.dev/github.com/google/go-github/v60/github#IssueComment

type IssueCommentEvent added in v0.5.156

type IssueCommentEvent struct {
	Action       bigquery.NullString `json:"action,omitempty" bigquery:"action"`
	Issue        Issue               `json:"issue,omitempty" bigquery:"issue"`
	Comment      IssueComment        `json:"comment,omitempty" bigquery:"comment"`
	Repo         Repository          `json:"repository,omitempty" bigquery:"repository"`
	Sender       User                `json:"sender,omitempty" bigquery:"sender"`
	Organization Organization        `json:"organization,omitempty" bigquery:"organization"`
	Installation *Installation       `json:"installation,omitempty" bigquery:"installation"`
}

https://pkg.go.dev/github.com/google/go-github/v60/github#IssueCommentEvent

type IssueEvent added in v0.5.156

type IssueEvent struct {
	ID                bigquery.NullInt64     `json:"id,omitempty" bigquery:"id"`
	URL               bigquery.NullString    `json:"url,omitempty" bigquery:"url"`
	Actor             User                   `json:"actor,omitempty" bigquery:"actor"`
	Action            bigquery.NullString    `json:"action,omitempty" bigquery:"action"`
	Event             bigquery.NullString    `json:"event,omitempty" bigquery:"event"`
	CreatedAt         bigquery.NullTimestamp `json:"created_at,omitempty" bigquery:"created_at"`
	Issue             Issue                  `json:"issue,omitempty" bigquery:"issue"`
	Repository        Repository             `json:"repository,omitempty" bigquery:"repository"`
	Assignee          User                   `json:"assignee,omitempty" bigquery:"assignee"`
	Assigner          User                   `json:"assigner,omitempty" bigquery:"assigner"`
	CommitID          bigquery.NullString    `json:"commit_id,omitempty" bigquery:"commit_id"`
	Label             Label                  `json:"label,omitempty" bigquery:"label"`
	LockReason        bigquery.NullString    `json:"lock_reason,omitempty" bigquery:"lock_reason"`
	RequestedReviewer User                   `json:"requested_reviewer,omitempty" bigquery:"requested_reviewer"`
	ReviewRequester   User                   `json:"review_requester,omitempty" bigquery:"review_requester"`
	Installation      *Installation          `json:"installation,omitempty" bigquery:"installation"`
}

https://pkg.go.dev/github.com/google/go-github/v60/github#IssueEvent

type Label added in v0.5.29

type Label struct {
	Name bigquery.NullString `json:"name,omitempty" bigquery:"name"`
}

type Organization

type Organization struct {
	Login bigquery.NullString `json:"login,omitempty" bigquery:"login"`
}

https://pkg.go.dev/github.com/google/go-github/v60/github#Organization

type ProjectV2Item added in v0.5.156

type ProjectV2Item struct {
	ID            bigquery.NullInt64     `json:"id,omitempty" bigquery:"id"`
	NodeID        bigquery.NullString    `json:"node_id,omitempty" bigquery:"node_id"`
	ProjectNodeID bigquery.NullString    `json:"project_node_id,omitempty" bigquery:"project_node_id"`
	ContentNodeID bigquery.NullString    `json:"content_node_id,omitempty" bigquery:"content_node_id"`
	ContentType   bigquery.NullString    `json:"content_type,omitempty" bigquery:"content_type"`
	Creator       *User                  `json:"creator,omitempty" bigquery:"creator"`
	CreatedAt     bigquery.NullTimestamp `json:"created_at,omitempty" bigquery:"created_at"`
	UpdatedAt     bigquery.NullTimestamp `json:"updated_at,omitempty" bigquery:"updated_at"`
	ArchivedAt    bigquery.NullTimestamp `json:"archived_at,omitempty" bigquery:"archived_at"`
}

https://github.com/google/go-github/blob/v60.0.0/github/event_types.go#L1085

type ProjectsV2ItemEvent added in v0.5.156

type ProjectsV2ItemEvent struct {
	Action        bigquery.NullString `json:"action,omitempty" bigquery:"action"`
	Changes       bigquery.NullJSON   `json:"changes,omitempty" bigquery:"changes"`
	ProjectV2Item *ProjectV2Item      `json:"projects_v2_item,omitempty" bigquery:"projects_v2_item"`
	Organization  *Organization       `json:"organization,omitempty" bigquery:"organization"`
	Sender        *User               `json:"sender,omitempty" bigquery:"sender"`
	Installation  *Installation       `json:"installation,omitempty" bigquery:"installation"`
}

https://github.com/google/go-github/blob/v60.0.0/github/event_types.go#L1062

type PullRequest

type PullRequest struct {
	Number bigquery.NullInt64  `json:"number,omitempty" bigquery:"number"`
	State  bigquery.NullString `json:"state,omitempty" bigquery:"state"`
	Title  bigquery.NullString `json:"title,omitempty" bigquery:"title"`

	Base PullRequestBranch `json:"base,omitempty" bigquery:"base"`
	Head PullRequestBranch `json:"head,omitempty" bigquery:"head"`

	Labels []Label `json:"labels" bigquery:"labels"`

	CreatedAt bigquery.NullTimestamp `json:"created_at,omitempty" bigquery:"created_at"`
	UpdatedAt bigquery.NullTimestamp `json:"updated_at,omitempty" bigquery:"updated_at"`
	ClosedAt  bigquery.NullTimestamp `json:"closed_at,omitempty" bigquery:"closed_at"`
	MergedAt  bigquery.NullTimestamp `json:"merged_at,omitempty" bigquery:"merged_at"`

	Mergeable      bigquery.NullBool   `json:"mergeable,omitempty" bigquery:"mergeable"`
	MergeableState bigquery.NullString `json:"mergeable_state,omitempty" bigquery:"mergeable_state"`
	MergedBy       User                `json:"merged_by,omitempty" bigquery:"merged_by"`
	MergeCommitSHA bigquery.NullString `json:"merge_commit_sha,omitempty" bigquery:"merge_commit_sha"`

	Additions    bigquery.NullInt64 `json:"additions,omitempty" bigquery:"additions"`
	Deletions    bigquery.NullInt64 `json:"deletions,omitempty" bigquery:"deletions"`
	ChangedFiles bigquery.NullInt64 `json:"changed_files,omitempty" bigquery:"changed_files"`
}

https://pkg.go.dev/github.com/google/go-github/v60/github#PullRequest

type PullRequestBranch added in v0.5.29

type PullRequestBranch struct {
	Ref  bigquery.NullString `json:"ref,omitempty" bigquery:"ref"`
	SHA  bigquery.NullString `json:"sha,omitempty" bigquery:"sha"`
	Repo Repository          `json:"repo,omitempty" bigquery:"repo"`
	User User                `json:"user,omitempty" bigquery:"user"`
}

https://pkg.go.dev/github.com/google/go-github/v60/github#PullRequestBranch

type PullRequestEvent

type PullRequestEvent struct {
	// assigned,opened  etc.
	Action       bigquery.NullString `json:"action,omitempty" bigquery:"action"`
	Sender       User                `json:"sender,omitempty" bigquery:"sender"`
	Assignee     User                `json:"assignee,omitempty" bigquery:"assignee"`
	Repository   Repository          `json:"repository,omitempty" bigquery:"repository"`
	Organization Organization        `json:"organization,omitempty" bigquery:"organization"`

	PullRequest PullRequest `json:"pull_request,omitempty" bigquery:"pull_request"`

	// Populated when action is synchronize
	Before bigquery.NullString `json:"before,omitempty" bigquery:"before"`
	After  bigquery.NullString `json:"after,omitempty" bigquery:"after"`

	Installation *Installation `json:"installation,omitempty" bigquery:"installation"`
}

https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request https://pkg.go.dev/github.com/google/go-github/v60/github#PullRequestEvent

type PullRequestLinks struct {
	URL      bigquery.NullString    `json:"url,omitempty" bigquery:"url"`
	HTMLURL  bigquery.NullString    `json:"html_url,omitempty" bigquery:"html_url"`
	DiffURL  bigquery.NullString    `json:"diff_url,omitempty" bigquery:"diff_url"`
	PatchURL bigquery.NullString    `json:"patch_url,omitempty" bigquery:"patch_url"`
	MergedAt bigquery.NullTimestamp `json:"merged_at,omitempty" bigquery:"merged_at"`
}

type PullRequestReview added in v0.6.160

type PullRequestReview struct {
	ID                bigquery.NullInt64     `json:"id,omitempty" bigquery:"id"`
	NodeID            bigquery.NullString    `json:"node_id,omitempty" bigquery:"node_id"`
	User              User                   `json:"user,omitempty" bigquery:"user"`
	Body              bigquery.NullString    `json:"body,omitempty" bigquery:"body"`
	State             bigquery.NullString    `json:"state,omitempty" bigquery:"state"`
	HTMLURL           bigquery.NullString    `json:"html_url,omitempty" bigquery:"html_url"`
	PullRequestURL    bigquery.NullString    `json:"pull_request_url,omitempty" bigquery:"pull_request_url"`
	SubmittedAt       bigquery.NullTimestamp `json:"submitted_at,omitempty" bigquery:"submitted_at"`
	CommitID          bigquery.NullString    `json:"commit_id,omitempty" bigquery:"commit_id"`
	AuthorAssociation bigquery.NullString    `json:"author_association,omitempty" bigquery:"author_association"`
}

https://pkg.go.dev/github.com/google/go-github/v60/github#PullRequestReview

type PullRequestReviewComment added in v0.6.160

type PullRequestReviewComment struct {
	ID                  bigquery.NullInt64     `json:"id,omitempty" bigquery:"id"`
	NodeID              bigquery.NullString    `json:"node_id,omitempty" bigquery:"node_id"`
	InReplyTo           bigquery.NullInt64     `json:"in_reply_to_id,omitempty" bigquery:"in_reply_to_id"`
	Body                bigquery.NullString    `json:"body,omitempty" bigquery:"body"`
	Path                bigquery.NullString    `json:"path,omitempty" bigquery:"path"`
	DiffHunk            bigquery.NullString    `json:"diff_hunk,omitempty" bigquery:"diff_hunk"`
	PullRequestReviewID bigquery.NullInt64     `json:"pull_request_review_id,omitempty" bigquery:"pull_request_review_id"`
	Position            bigquery.NullInt64     `json:"position,omitempty" bigquery:"position"`
	OriginalPosition    bigquery.NullInt64     `json:"original_position,omitempty" bigquery:"original_position"`
	StartLine           bigquery.NullInt64     `json:"start_line,omitempty" bigquery:"start_line"`
	Line                bigquery.NullInt64     `json:"line,omitempty" bigquery:"line"`
	OriginalLine        bigquery.NullInt64     `json:"original_line,omitempty" bigquery:"original_line"`
	OriginalStartLine   bigquery.NullInt64     `json:"original_start_line,omitempty" bigquery:"original_start_line"`
	Side                bigquery.NullString    `json:"side,omitempty" bigquery:"side"`
	StartSide           bigquery.NullString    `json:"start_side,omitempty" bigquery:"start_side"`
	CommitID            bigquery.NullString    `json:"commit_id,omitempty" bigquery:"commit_id"`
	OriginalCommitID    bigquery.NullString    `json:"original_commit_id,omitempty" bigquery:"original_commit_id"`
	User                User                   `json:"user,omitempty" bigquery:"user"`
	CreatedAt           bigquery.NullTimestamp `json:"created_at,omitempty" bigquery:"created_at"`
	UpdatedAt           bigquery.NullTimestamp `json:"updated_at,omitempty" bigquery:"updated_at"`
	AuthorAssociation   bigquery.NullString    `json:"author_association,omitempty" bigquery:"author_association"`
	URL                 bigquery.NullString    `json:"url,omitempty" bigquery:"url"`
	HTMLURL             bigquery.NullString    `json:"html_url,omitempty" bigquery:"html_url"`
	PullRequestURL      bigquery.NullString    `json:"pull_request_url,omitempty" bigquery:"pull_request_url"`
}

https://pkg.go.dev/github.com/google/go-github/v60/github#PullRequestComment

type PullRequestReviewCommentEvent added in v0.6.160

type PullRequestReviewCommentEvent struct {
	Action       bigquery.NullString      `json:"action,omitempty" bigquery:"action"`
	Comment      PullRequestReviewComment `json:"comment,omitempty" bigquery:"comment"`
	PullRequest  PullRequest              `json:"pull_request,omitempty" bigquery:"pull_request"`
	Repository   Repository               `json:"repository,omitempty" bigquery:"repository"`
	Organization Organization             `json:"organization,omitempty" bigquery:"organization"`
	Sender       User                     `json:"sender,omitempty" bigquery:"sender"`
	Installation *Installation            `json:"installation,omitempty" bigquery:"installation"`
}

https://pkg.go.dev/github.com/google/go-github/v60/github#PullRequestReviewCommentEvent

type PullRequestReviewEvent added in v0.6.160

type PullRequestReviewEvent struct {
	Action       bigquery.NullString `json:"action,omitempty" bigquery:"action"`
	Review       PullRequestReview   `json:"review,omitempty" bigquery:"review"`
	PullRequest  PullRequest         `json:"pull_request,omitempty" bigquery:"pull_request"`
	Repository   Repository          `json:"repository,omitempty" bigquery:"repository"`
	Organization Organization        `json:"organization,omitempty" bigquery:"organization"`
	Sender       User                `json:"sender,omitempty" bigquery:"sender"`
	Installation *Installation       `json:"installation,omitempty" bigquery:"installation"`
}

https://pkg.go.dev/github.com/google/go-github/v60/github#PullRequestReviewEvent

type PushEvent added in v0.5.156

type PushEvent struct {
	PushID       bigquery.NullInt64  `json:"push_id,omitempty" bigquery:"push_id"`
	Head         bigquery.NullString `json:"head,omitempty" bigquery:"head"`
	Ref          bigquery.NullString `json:"ref,omitempty" bigquery:"ref"`
	Size         bigquery.NullInt64  `json:"size,omitempty" bigquery:"size"`
	Before       bigquery.NullString `json:"before,omitempty" bigquery:"before"`
	DistinctSize bigquery.NullInt64  `json:"distinct_size,omitempty" bigquery:"distinct_size"`

	// The following fields are only populated by Webhook events.
	Action  bigquery.NullString `json:"action,omitempty" bigquery:"action"`
	After   bigquery.NullString `json:"after,omitempty" bigquery:"after"`
	BaseRef bigquery.NullString `json:"base_ref,omitempty" bigquery:"base_ref"`
	Repo    PushEventRepository `json:"repository,omitempty" bigquery:"repository"`
	Sender  User                `json:"sender,omitempty" bigquery:"sender"`

	Organization Organization `json:"organization,omitempty" bigquery:"organization"`

	Installation *Installation `json:"installation,omitempty" bigquery:"installation"`
}

https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#push https://pkg.go.dev/github.com/google/go-github/v68/github#PushEvent

type PushEventRepository added in v0.5.156

type PushEventRepository struct {
	Owner    User                `json:"owner,omitempty" bigquery:"owner"`
	Name     bigquery.NullString `json:"name,omitempty" bigquery:"name"`
	URL      bigquery.NullString `json:"url,omitempty" bigquery:"url"`
	FullName bigquery.NullString `json:"full_name,omitempty" bigquery:"full_name"`
}

https://pkg.go.dev/github.com/google/go-github/v68/github#PushEventRepository

type Repository

type Repository struct {
	Owner    User                `json:"owner,omitempty" bigquery:"owner"`
	Name     bigquery.NullString `json:"name,omitempty" bigquery:"name"`
	URL      bigquery.NullString `json:"url,omitempty" bigquery:"url"`
	FullName bigquery.NullString `json:"full_name,omitempty" bigquery:"full_name"`
}

https://pkg.go.dev/github.com/google/go-github/v60/github#Repository

type User

type User struct {
	Login bigquery.NullString `json:"login,omitempty" bigquery:"login"`
	Type  bigquery.NullString `json:"type,omitempty" bigquery:"type"`
}

https://pkg.go.dev/github.com/google/go-github/v60/github#User

type Workflow

type Workflow struct {
	ID    bigquery.NullInt64  `json:"id,omitempty" bigquery:"id"`
	Name  bigquery.NullString `json:"name,omitempty" bigquery:"name"`
	Path  bigquery.NullString `json:"path,omitempty" bigquery:"path"`
	State bigquery.NullString `json:"state,omitempty" bigquery:"state"`

	CreatedAt bigquery.NullTimestamp `json:"created_at,omitempty" bigquery:"created_at"`
	UpdatedAt bigquery.NullTimestamp `json:"updated_at,omitempty" bigquery:"updated_at"`
}

https://pkg.go.dev/github.com/google/go-github/v60/github#Workflow

type WorkflowJob added in v1.0.6

type WorkflowJob struct {
	ID              bigquery.NullInt64     `json:"id,omitempty" bigquery:"id"`
	RunID           bigquery.NullInt64     `json:"run_id,omitempty" bigquery:"run_id"`
	RunAttempt      bigquery.NullInt64     `json:"run_attempt,omitempty" bigquery:"run_attempt"`
	WorkflowName    bigquery.NullString    `json:"workflow_name,omitempty" bigquery:"workflow_name"`
	HeadBranch      bigquery.NullString    `json:"head_branch,omitempty" bigquery:"head_branch"`
	HeadSHA         bigquery.NullString    `json:"head_sha,omitempty" bigquery:"head_sha"`
	Name            bigquery.NullString    `json:"name,omitempty" bigquery:"name"`
	Status          bigquery.NullString    `json:"status,omitempty" bigquery:"status"`
	Conclusion      bigquery.NullString    `json:"conclusion,omitempty" bigquery:"conclusion"`
	CreatedAt       bigquery.NullTimestamp `json:"created_at,omitempty" bigquery:"created_at"`
	StartedAt       bigquery.NullTimestamp `json:"started_at,omitempty" bigquery:"started_at"`
	CompletedAt     bigquery.NullTimestamp `json:"completed_at,omitempty" bigquery:"completed_at"`
	RunnerID        bigquery.NullInt64     `json:"runner_id,omitempty" bigquery:"runner_id"`
	RunnerName      bigquery.NullString    `json:"runner_name,omitempty" bigquery:"runner_name"`
	RunnerGroupID   bigquery.NullInt64     `json:"runner_group_id,omitempty" bigquery:"runner_group_id"`
	RunnerGroupName bigquery.NullString    `json:"runner_group_name,omitempty" bigquery:"runner_group_name"`
	Labels          []string               `json:"labels,omitempty" bigquery:"labels"`
	Steps           []WorkflowJobStep      `json:"steps,omitempty" bigquery:"steps"`
}

https://pkg.go.dev/github.com/google/go-github/v60/github#WorkflowJob

type WorkflowJobEvent added in v1.0.6

type WorkflowJobEvent struct {
	// queued, in_progress, completed, waiting
	Action       bigquery.NullString `json:"action,omitempty" bigquery:"action"`
	WorkflowJob  WorkflowJob         `json:"workflow_job,omitempty" bigquery:"workflow_job"`
	Organization Organization        `json:"organization,omitempty" bigquery:"organization"`
	Repository   Repository          `json:"repository,omitempty" bigquery:"repository"`
	Sender       User                `json:"sender,omitempty" bigquery:"sender"`
	Installation *Installation       `json:"installation,omitempty" bigquery:"installation"`
}

https://docs.github.com/en/webhooks/webhook-events-and-payloads#workflow_job subset of https://pkg.go.dev/github.com/google/go-github/v60/github#WorkflowJobEvent

type WorkflowJobStep added in v1.0.6

type WorkflowJobStep struct {
	Name        bigquery.NullString    `json:"name,omitempty" bigquery:"name"`
	Status      bigquery.NullString    `json:"status,omitempty" bigquery:"status"`
	Conclusion  bigquery.NullString    `json:"conclusion,omitempty" bigquery:"conclusion"`
	Number      bigquery.NullInt64     `json:"number,omitempty" bigquery:"number"`
	StartedAt   bigquery.NullTimestamp `json:"started_at,omitempty" bigquery:"started_at"`
	CompletedAt bigquery.NullTimestamp `json:"completed_at,omitempty" bigquery:"completed_at"`
}

https://pkg.go.dev/github.com/google/go-github/v60/github#TaskStep

type WorkflowRun

type WorkflowRun struct {
	ID           bigquery.NullInt64     `json:"id,omitempty" bigquery:"id"`
	RunNumber    bigquery.NullInt64     `json:"run_number,omitempty" bigquery:"run_number"`
	RunAttempt   bigquery.NullInt64     `json:"run_attempt,omitempty" bigquery:"run_attempt"`
	HeadBranch   bigquery.NullString    `json:"head_branch,omitempty" bigquery:"head_branch"`
	HeadSHA      bigquery.NullString    `json:"head_sha,omitempty" bigquery:"head_sha"`
	Name         bigquery.NullString    `json:"name,omitempty" bigquery:"name"`
	Event        bigquery.NullString    `json:"event,omitempty" bigquery:"event"`
	Status       bigquery.NullString    `json:"status,omitempty" bigquery:"status"`
	CreatedAt    bigquery.NullTimestamp `json:"created_at,omitempty" bigquery:"created_at"`
	UpdatedAt    bigquery.NullTimestamp `json:"updated_at,omitempty" bigquery:"updated_at"`
	RunStartedAt bigquery.NullTimestamp `json:"run_started_at,omitempty" bigquery:"run_started_at"`
	// CompletedAt is retained as a noop field. GitHub does not populate it on
	// workflow_run payloads (see struct comment above), so it is always NULL.
	// Removing it would change the BQ schema and trigger table recreation,
	// which is blocked by deletion_protection on the recorder. Use
	// updated_at on action="completed" events, or workflow_job.completed_at,
	// for the run's terminal-state timestamp.
	CompletedAt bigquery.NullTimestamp `json:"completed_at,omitempty" bigquery:"completed_at"`

	// success, failure, cancelled, etc.
	Conclusion bigquery.NullString `json:"conclusion,omitempty" bigquery:"conclusion"`
}

https://pkg.go.dev/github.com/google/go-github/v60/github#WorkflowRun

Note: GitHub does not include `completed_at` on the workflow_run object in webhook payloads. For action="completed" events, `updated_at` is the moment the run reached terminal state. For accurate per-job/per-step duration metrics use the workflow_job event instead.

type WorkflowRunEvent

type WorkflowRunEvent struct {
	// completed, etc.
	Action       bigquery.NullString `json:"action,omitempty" bigquery:"action"`
	Workflow     Workflow            `json:"workflow,omitempty" bigquery:"workflow"`
	WorkflowRun  WorkflowRun         `json:"workflow_run,omitempty" bigquery:"workflow_run"`
	Organization Organization        `json:"organization,omitempty" bigquery:"organization"`
	Repository   Repository          `json:"repository,omitempty" bigquery:"repository"`
	Sender       User                `json:"sender,omitempty" bigquery:"sender"`
	Installation *Installation       `json:"installation,omitempty" bigquery:"installation"`
}

https://docs.github.com/developers/webhooks-and-events/webhook-events-and-payloads#workflow_run subset of https://pkg.go.dev/github.com/google/go-github/v60/github#WorkflowRunEvent

type Wrapper

type Wrapper[T any] struct {
	When    time.Time
	Headers *GitHubHeaders
	Body    T
}
Example
package main

import (
	"fmt"
	"time"

	"github.com/chainguard-dev/terraform-infra-common/modules/github-events/schemas"
)

func main() {
	w := schemas.Wrapper[schemas.PullRequest]{
		When: time.Date(2025, 1, 1, 0, 0, 0, 0, time.UTC),
	}
	fmt.Println(w.When.Year())
}
Output:
2025

Jump to

Keyboard shortcuts

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