ghevent

package
v1.2.13 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package ghevent appends entries to the Redis stream ev:github and reads them back.

Every entry has the fields repo, kind, number, head, action, at, sender, comment_id. Four kinds add their own fields, always all of them, empty included: pull_request adds branch, base and merged (closed only: true or false); issues adds labels (a JSON array of the issue's label names after the change), body, state and state_reason; workflow_run adds run_id, workflow, status and conclusion; check_run adds check (check_run.name), check_run_id (check_run.id), status and conclusion; runner rows are keyed by check name and ordered by attempt id and status.

Index

Constants

View Source
const Stream = gheventwire.Stream

Stream is the Redis stream every carried delivery is appended to.

Variables

This section is empty.

Functions

func Fields

func Fields(e Entry) (map[string]interface{}, error)

Fields is the stream entry's key set for e: the eight common fields, plus the issues, workflow_run, check_run or pull_request fields for those kinds.

func Publish

func Publish(ctx context.Context, rdb *redis.Client, e Entry) (string, error)

Publish appends one entry. Every named field of the entry's kind is written, empty string included, so a reader can rely on the key set. A ping may have no repo (a hook with neither repository nor organization); every other kind needs one.

Types

type Entry

type Entry struct {
	Repo      string
	Kind      string
	Number    string
	Head      string
	Action    string
	At        string
	Sender    string
	CommentID string

	// issues only.
	Labels      []string
	Body        string
	State       string
	StateReason string

	// workflow_run only.
	RunID    string
	Workflow string

	// pull_request only (card pr-record-follows-github): the head branch,
	// the base branch and, on closed, "true" when the PR merged ("false"
	// otherwise, "" on the other actions).
	Branch string
	Base   string
	Merged string

	// check_run only: the check's name and its id (a decimal string).
	Check      string
	CheckRunID string

	// workflow_run and check_run.
	Status     string
	Conclusion string
}

Entry is one ev:github record. Number and CommentID are decimal strings, empty when the payload has none, so a missing pull request is not number 0.

Directories

Path Synopsis
Package wire holds the stream identity shared by GitHub event writers and readers.
Package wire holds the stream identity shared by GitHub event writers and readers.

Jump to

Keyboard shortcuts

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