Documentation
¶
Index ¶
- Constants
- func AppendGitHubOutput(path, name, value string) error
- func CreateIssueComment(ctx context.Context, client *github.Client, owner, repo string, ...) error
- func DecodeEvent[T any](data []byte) (T, error)
- func GitHubOutputPath() string
- func GitHubToken() string
- func ListCommitSHAs(exec semver.Execer, compareRange string) ([]string, error)
- func ListPullRequestFilenames(ctx context.Context, client *github.Client, owner, repo string, pullNumber int) ([]string, error)
- func LoadEvent[T any](path string) (T, error)
- func NewGitHubClient(ctx context.Context, token string) (*github.Client, error)
- func OptionalPullRequestNumberFromEventPath(path string) (int, error)
- func OwnerRepoFromEnv() (owner, repo string, err error)
- func ParseGitHubOwnerRepo(repository string) (owner, repo string, err error)
- func PullRequestsAssociatedWithCommit(ctx context.Context, client *github.Client, owner, repo, sha string) ([]*github.PullRequest, error)
- func ReadEventPayload(path string) ([]byte, error)
- func UpdateIssueComment(ctx context.Context, client *github.Client, owner, repo string, ...) error
- type ChangelogPullSummary
- type ChangelogWorkflowPullRequests
- func (w *ChangelogWorkflowPullRequests) AddIssueLabels(ctx context.Context, owner, repo string, issueNumber int, labels []string) error
- func (w *ChangelogWorkflowPullRequests) CreatePullRequest(ctx context.Context, owner, repo string, title, body, head, base string) (*ChangelogPullSummary, error)
- func (w *ChangelogWorkflowPullRequests) ListOpenPullRequestsByHead(ctx context.Context, owner, repo, headRef, baseBranch string) ([]ChangelogPullSummary, error)
- func (w *ChangelogWorkflowPullRequests) UpdatePullRequestBody(ctx context.Context, owner, repo string, number int, body string) error
- type IssueComment
- type ShellGit
Constants ¶
const ( // EnvGitHubRepository is the actions-provided repo slug "owner/name". EnvGitHubRepository = "GITHUB_REPOSITORY" // EnvGitHubEventPath carries the workflow event payload JSON path. EnvGitHubEventPath = "GITHUB_EVENT_PATH" // EnvGitHubToken carries the bearer token used by REST calls. EnvGitHubToken = "GITHUB_TOKEN" // EnvGitHubOutput names the file path for step outputs. EnvGitHubOutput = "GITHUB_OUTPUT" // EnvMode selects unreleased vs release engine behaviour. EnvMode = "MODE" // EnvTargetVersion is the semver X.Y.Z for release mode (no leading v). EnvTargetVersion = "TARGET_VERSION" // EnvTargetBranch optionally overrides the branch name written to outputs. EnvTargetBranch = "TARGET_BRANCH" // EnvChangelogPath overrides the CHANGELOG.md path. EnvChangelogPath = "CHANGELOG_PATH" // EnvPreviousTag is the tag spanning the changelog compare range baseline. EnvPreviousTag = "PREVIOUS_TAG" // EnvCompareRange is git rev-list range (e.g. v1.0.0..HEAD). EnvCompareRange = "COMPARE_RANGE" // EnvInput* mirror actions/core getInput env fallbacks used by github-script steps. EnvInputPreviousTag = "INPUT_PREVIOUS_TAG" EnvInputCompareRange = "INPUT_COMPARE_RANGE" EnvInputMode = "INPUT_MODE" EnvInputTargetVersion = "INPUT_TARGET_VERSION" )
Variables ¶
This section is empty.
Functions ¶
func AppendGitHubOutput ¶
AppendGitHubOutput appends name=value pairs to path (the file named by GITHUB_OUTPUT). Single-line values use "name=value\n". Values containing newlines use GitHub Actions heredoc framing with a random delimiter token.
func CreateIssueComment ¶
func CreateIssueComment(ctx context.Context, client *github.Client, owner, repo string, issueNumber int, body string) error
CreateIssueComment adds a comment to issueNumber.
func DecodeEvent ¶
DecodeEvent unmarshals raw JSON workflow event bytes into T.
func GitHubOutputPath ¶
func GitHubOutputPath() string
GitHubOutputPath returns trimmed GITHUB_OUTPUT (may be empty).
func GitHubToken ¶
func GitHubToken() string
GitHubToken returns trimmed GITHUB_TOKEN (may be empty).
func ListCommitSHAs ¶
ListCommitSHAs executes `git log --format=%H <range>` like changelog-engine-factory.js gatherMergedPRRecordsForRange.
func ListPullRequestFilenames ¶
func ListPullRequestFilenames( ctx context.Context, client *github.Client, owner, repo string, pullNumber int, ) ([]string, error)
ListPullRequestFilenames returns each changed file path for pullNumber (paginated). Mirrors pulls.listFiles usage in the changelog evidence gather path.
func NewGitHubClient ¶
NewGitHubClient returns a GitHub API client authenticated with token, mirroring scripts/auto-approve/main.go.
func OptionalPullRequestNumberFromEventPath ¶
OptionalPullRequestNumberFromEventPath returns payload.pull_request.number when the field is present. An empty path returns (0, nil). This mirrors optional chaining on context.payload.pull_request?.number used by changelog workflow scripts.
func OwnerRepoFromEnv ¶
OwnerRepoFromEnv reads GITHUB_REPOSITORY.
func ParseGitHubOwnerRepo ¶
ParseGitHubOwnerRepo parses github.repository-style "owner/name".
func PullRequestsAssociatedWithCommit ¶
func PullRequestsAssociatedWithCommit( ctx context.Context, client *github.Client, owner, repo, sha string, ) ([]*github.PullRequest, error)
PullRequestsAssociatedWithCommit lists merged/closed associations for sha (paginated).
func ReadEventPayload ¶
ReadEventPayload reads the raw JSON payload from path (typically $GITHUB_EVENT_PATH).
Types ¶
type ChangelogPullSummary ¶
ChangelogPullSummary captures number and HTML URL returned from pull request APIs.
type ChangelogWorkflowPullRequests ¶
ChangelogWorkflowPullRequests implements GitHub pulls/issues calls used by changelog-generation workflow helpers (changelog-pr-management.js parity).
func (*ChangelogWorkflowPullRequests) AddIssueLabels ¶
func (w *ChangelogWorkflowPullRequests) AddIssueLabels(ctx context.Context, owner, repo string, issueNumber int, labels []string) error
AddIssueLabels attaches labels to a pull (issues.addLabels parity).
func (*ChangelogWorkflowPullRequests) CreatePullRequest ¶
func (w *ChangelogWorkflowPullRequests) CreatePullRequest(ctx context.Context, owner, repo string, title, body, head, base string) (*ChangelogPullSummary, error)
CreatePullRequest opens a pull request (mirrors pulls.create inputs used by changelog workflow).
func (*ChangelogWorkflowPullRequests) ListOpenPullRequestsByHead ¶
func (w *ChangelogWorkflowPullRequests) ListOpenPullRequestsByHead(ctx context.Context, owner, repo, headRef, baseBranch string) ([]ChangelogPullSummary, error)
ListOpenPullRequestsByHead lists open pulls where Head is owner:branchSlug and Base is baseBranch.
func (*ChangelogWorkflowPullRequests) UpdatePullRequestBody ¶
func (w *ChangelogWorkflowPullRequests) UpdatePullRequestBody(ctx context.Context, owner, repo string, number int, body string) error
UpdatePullRequestBody sets the pull body (mirrors pulls.update body-only updates).
type IssueComment ¶
IssueComment summarizes a REST issue comment (PR comments use the issue comments API).
func ListIssueComments ¶
func ListIssueComments(ctx context.Context, client *github.Client, owner, repo string, issueNumber int) ([]IssueComment, error)
ListIssueComments lists all comments for issueNumber (paginated).