comment

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2026 License: MIT Imports: 5 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package comment upserts a single sticky PR comment identified by a marker.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Comment

type Comment struct {
	ID   int64
	Body string
}

Comment is a minimal issue/PR comment.

type Commenter

type Commenter interface {
	List(ctx context.Context) ([]Comment, error)
	Create(ctx context.Context, body string) (Comment, error)
	Update(ctx context.Context, id int64, body string) (Comment, error)
}

Commenter is the seam over the GitHub issue-comments API, so the sticky logic is testable without network access.

type GitHubCommenter

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

GitHubCommenter implements Commenter against a real repository PR using the GitHub issue-comments API (PRs are issues for commenting purposes).

func NewGitHubCommenter

func NewGitHubCommenter(ctx context.Context, hc *http.Client, token, owner, repo string, number int) (*GitHubCommenter, error)

NewGitHubCommenter builds a Commenter for owner/repo#number authenticated with token (typically the Actions GITHUB_TOKEN). A nil hc selects a default http.Client.

func (*GitHubCommenter) Create

func (g *GitHubCommenter) Create(ctx context.Context, body string) (Comment, error)

func (*GitHubCommenter) List

func (g *GitHubCommenter) List(ctx context.Context) ([]Comment, error)

func (*GitHubCommenter) Update

func (g *GitHubCommenter) Update(ctx context.Context, id int64, body string) (Comment, error)

type Result

type Result struct {
	Action string // "created" or "updated"
	ID     int64
}

Result reports what Upsert did.

func Upsert

func Upsert(ctx context.Context, c Commenter, marker, body string) (Result, error)

Upsert posts body as a new comment, or edits the existing comment whose body contains marker. This keeps a single sticky comment that refreshes in place on every re-run instead of piling up.

Jump to

Keyboard shortcuts

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