issues

package
v0.0.0-...-6f1d02b Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2026 License: Apache-2.0 Imports: 21 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 issues keeps every repository's open issues and says for each where it stands (design/issues.md, P-69).

Index

Constants

View Source
const ConfirmAfter = 30 * time.Second

Events are the webhook deliveries that re-read a repository's issues (webhook.Normalise passes them by their names). Not issue_comment: anyone may comment, and a comment changes an issue's idle time and count, not where it stands. ConfirmAfter is when a run caused by an event reads again: GitHub's listing can be a few seconds behind the event.

View Source
const Kind = "issues"

Kind is the job kind that reads a repository's open issues.

Variables

View Source
var Events = []sync.Event{"issues", sync.EventOpen} //nolint:gochecknoglobals // a constant list
View Source
var Kinds = []IssueKind{KindBug, KindFeature, KindQuestion, KindOther} //nolint:gochecknoglobals // a constant list

Kinds are the kinds in the order the lists tell them.

View Source
var States = []State{StateTriage, StateUnassigned, StateAssigned} //nolint:gochecknoglobals // a constant list

States are the states in the order the lists tell them: what waits first.

Functions

func Counts

func Counts(refs []Ref, by By) oapi.IssueCounts

Counts are the open issues of refs that by keeps.

func Feeds

func Feeds() snapshot.Indexer

Feeds is the indexer of the merged issues, for snapshot.NewPublisher.

func IssueOf

func IssueOf(r Ref) oapi.Issue

IssueOf is an issue in its API form.

func Summary

func Summary(e *snapshot.RepoEntry) (open, triage int)

Summary is a repository's open issues and how many need triage (open -1 when not read yet), for its Markdown.

Types

type API

type API struct {
	Current func(context.Context) *snapshot.Snapshot // the viewer's view
	Off     bool                                     // switched off (features.issues): every request is answered 404
}

API serves the open issues from the current snapshot. It implements the issues method of the strict server.

type By

type By uint8

By selects whose issues count.

const (
	ByAll        By = iota
	ByPeople        // people's only
	ByAutomation    // automation's only
)

type Fetcher

type Fetcher interface {
	// Open lists up to maxIssues open issues, the most recently updated first; exact reports that every one was listed.
	Open(ctx context.Context, owner, name string) (issues []Listed, exact bool, err error)
}

Fetcher reads a repository's open issues.

func FromGitHub

func FromGitHub(src REST) Fetcher

FromGitHub reads issues through src.

type Issue

type Issue struct {
	Number    int       `json:"n"`
	Title     string    `json:"title"`
	URL       string    `json:"url"`
	Author    string    `json:"author"`
	Bot       bool      `json:"bot,omitempty"`
	Created   time.Time `json:"created"`
	Updated   time.Time `json:"updated"`
	Labels    []Label   `json:"labels,omitempty"`
	Assignees []string  `json:"assignees,omitempty"` // the first maxPeople
	Assigned  int       `json:"assigned,omitempty"`  // every assignee counted
	Comments  int       `json:"comments,omitempty"`
	Milestone string    `json:"milestone,omitempty"`
	Type      string    `json:"type,omitempty"` // GitHub's issue type
}

Issue is an open issue as the listing gives it, cleaned.

type IssueKind

type IssueKind string

IssueKind is what an issue asks for.

const (
	KindBug      IssueKind = "bug"
	KindFeature  IssueKind = "feature"
	KindQuestion IssueKind = "question"
	KindOther    IssueKind = "other"
)

func KindOf

func KindOf(i *Issue) IssueKind

KindOf is GitHub's issue type when it names a kind, else the first label that does, else other.

type Issues

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

Issues is the issues feature.

func New

func New(sources map[string]Fetcher, o Options) *Issues

New returns the feature for one Fetcher per source id.

func (*Issues) Spec

func (f *Issues) Spec() sync.Spec

Spec is the per-repository issues job.

type Label

type Label = untrusted.Label

Label is an issue's label.

type Listed

type Listed struct {
	Number             int
	Title, URL, Author string
	AuthorBot          bool // the author's account type is Bot
	Created, Updated   time.Time
	Labels             []Label
	Assignees          []string // the first maxListed logins
	Assigned           int      // every assignee counted
	Comments           int
	Milestone, Type    string
	// contains filtered or unexported fields
}

Listed is an open issue as GitHub's REST listing gives it.

type Options

type Options struct {
	// Repo is the catalogued repository at a key: an archived one is read once.
	Repo func(snapshot.RepoKey) (snapshot.Repo, bool)
}

Options are what the job reads of the catalogue.

type REST

type REST interface {
	REST(ctx context.Context, owner, name string) (*gh.Client, error)
}

REST is a source's GitHub API client per owner; *github.Source implements it.

type Ref

type Ref struct {
	Repo  snapshot.RepoKey
	Issue *Issue
	State State
	Kind  IssueKind
}

Ref is an open issue of a repository with where it stands.

func All

func All(s *snapshot.Snapshot) []Ref

All is every open issue of s, what waits first.

func OfGroup

func OfGroup(s *snapshot.Snapshot, id string) []Ref

OfGroup is a group's open issues in s, what waits first.

func OfRepo

func OfRepo(s *snapshot.Snapshot, k snapshot.RepoKey) []Ref

OfRepo is a repository's open issues in s, what waits first.

type Set

type Set struct {
	Total  int     `json:"total"`           // open issues on GitHub when Exact, else at least len(Issues)
	Exact  bool    `json:"exact,omitempty"` // every page was read
	Issues []Issue `json:"issues"`
}

Set is a repository's open issues, the most recently updated first.

func Of

Of is a repository's open issues (nil when not read yet) with their freshness.

type State

type State string

State is where an issue stands, the first that holds.

const (
	StateAssigned   State = "assigned"   // someone has it
	StateTriage     State = "triage"     // no label, milestone or issue type: nobody has looked at it
	StateUnassigned State = "unassigned" // looked at, nobody took it
)

func StateOf

func StateOf(i *Issue) State

StateOf is where i stands.

Jump to

Keyboard shortcuts

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