writer

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DiscussionToMarkdown

func DiscussionToMarkdown(d *github.Discussion) (string, error)

DiscussionToMarkdown converts a discussion to markdown with YAML frontmatter.

func IssueToMarkdown

func IssueToMarkdown(issue *github.Issue) (string, error)

IssueToMarkdown converts an issue to markdown with YAML frontmatter.

func PullRequestToMarkdown

func PullRequestToMarkdown(pr *github.PullRequest) (string, error)

PullRequestToMarkdown converts a PR to markdown with YAML frontmatter.

func WriteDiscussion

func WriteDiscussion(d *github.Discussion) (string, error)

WriteDiscussion writes a discussion to the filesystem.

func WriteIssue

func WriteIssue(issue *github.Issue) (string, error)

WriteIssue writes an issue to the filesystem.

func WritePullRequest

func WritePullRequest(pr *github.PullRequest) (string, error)

WritePullRequest writes a PR to the filesystem.

Types

type BaseFrontmatter added in v0.2.0

type BaseFrontmatter struct {
	ID         string    `yaml:"id"`
	URL        string    `yaml:"url"`
	Number     int       `yaml:"number"`
	Owner      string    `yaml:"owner"`
	Repo       string    `yaml:"repo"`
	Title      string    `yaml:"title"`
	State      string    `yaml:"state"`
	Author     string    `yaml:"author,omitempty"`
	Created    time.Time `yaml:"created"`
	Updated    time.Time `yaml:"updated"`
	LastPulled time.Time `yaml:"last_pulled"`
}

BaseFrontmatter contains fields common to all item types.

type DiscussionFrontmatter

type DiscussionFrontmatter struct {
	BaseFrontmatter `yaml:",inline"`
	Category        string `yaml:"category"`
	AnswerID        string `yaml:"answer_id,omitempty"`
	Locked          bool   `yaml:"locked,omitempty"`
}

DiscussionFrontmatter represents the YAML frontmatter for a discussion.

type IssueFrontmatter

type IssueFrontmatter struct {
	BaseFrontmatter  `yaml:",inline"`
	Labels           []string                     `yaml:"labels,omitempty"`
	Assignees        []string                     `yaml:"assignees,omitempty"`
	Parent           *IssueReferenceFrontmatter   `yaml:"parent,omitempty"`
	Children         []IssueReferenceFrontmatter  `yaml:"children,omitempty"`
	SubIssuesSummary *SubIssuesSummaryFrontmatter `yaml:"sub_issues_summary,omitempty"`
}

IssueFrontmatter represents the YAML frontmatter for an issue.

type IssueReferenceFrontmatter

type IssueReferenceFrontmatter struct {
	Number int    `yaml:"number"`
	Title  string `yaml:"title"`
	URL    string `yaml:"url"`
	State  string `yaml:"state"`
	Owner  string `yaml:"owner,omitempty"` // Only if cross-repo
	Repo   string `yaml:"repo,omitempty"`  // Only if cross-repo
}

IssueReferenceFrontmatter represents a reference to a parent or child issue in frontmatter.

type Item added in v0.2.0

type Item interface {
	GetOwner() string
	GetRepo() string
	GetNumber() int
}

Item is an interface for items that can be written to markdown.

type PullRequestFrontmatter

type PullRequestFrontmatter struct {
	BaseFrontmatter `yaml:",inline"`
	Draft           bool      `yaml:"draft,omitempty"`
	Labels          []string  `yaml:"labels,omitempty"`
	Assignees       []string  `yaml:"assignees,omitempty"`
	Reviewers       []string  `yaml:"reviewers,omitempty"`
	HeadRef         string    `yaml:"head_ref"`
	BaseRef         string    `yaml:"base_ref"`
	MergeCommit     string    `yaml:"merge_commit,omitempty"`
	Merged          time.Time `yaml:"merged,omitempty"`
}

PullRequestFrontmatter represents the YAML frontmatter for a PR.

type SubIssuesSummaryFrontmatter

type SubIssuesSummaryFrontmatter struct {
	Total           int `yaml:"total"`
	Completed       int `yaml:"completed"`
	PercentComplete int `yaml:"percent_complete"`
}

SubIssuesSummaryFrontmatter provides statistics about sub-issues in frontmatter.

Jump to

Keyboard shortcuts

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