Documentation
¶
Overview ¶
Package github implements the GitHub Provider for the go-git-platform.
It builds on top of the official google/go-github SDK and adds the transport-layer cross-cutting behavior (auth, retry, hooks, logging) provided by the parent project's transport package. All Provider methods are split across the per-responsibility files in this package:
- github.go: constructor, registration, identity (Platform, TestConnection)
- repos.go: ListRepos, GetRepo, CreateRepo, DeleteRepo, UpdateRepo, ForkRepo
- crs.go: Change requests (PRs): Create/Get/List/Close/Merge/Reopen/Update/Comments/Commits
- webhooks.go: webhook CRUD + signature validation + event parsing
- branches.go: ListBranches, CreateBranch, DeleteBranch
- diffs.go: GetCRDiff, GetCRFiles, CreateNote/DeleteNote, CreateDiscussion
- commits.go: GetCommit, ListCommits, CompareCommits, CreateCommitStatus
- files.go: GetFileContent, CreateFile, UpdateFile, DeleteFile
- releases.go: ListTags, ListReleases, CreateRelease, GetArchive
- labels.go: repository label CRUD (LabelManager)
- issues.go: issue CRUD, comments, and issue labels (IssueManager)
- reviews.go: PR review list/get/create/dismiss/request-reviewers (ReviewManager)
- milestones.go: repository milestone CRUD (MilestoneManager)
- search.go: global repo/issue/user search (SearchManager)
- gists.go: ListMyGists, token 用户的 gist 列表 (GistManager)
- starred.go: ListStarred, 认证用户 star 的仓库 (StarredManager)
- migrations.go: CreateMigration/GetMigration, user/org 归档导出 (MigrationManager)
- release_assets.go: DownloadReleaseAsset 流式下载附件 (ReleaseAssetManager)
- types.go: internal GitHub-API types and conversion helpers
Index ¶
- func Divergences() []provider.Divergence
- func New(cfg provider.Config) (provider.Provider, error)
- type Provider
- func (p *Provider) AddCRCommentReaction(ctx context.Context, owner, repo string, commentID int64, emoji string) (*provider.Reaction, error)
- func (p *Provider) AddCollaborator(ctx context.Context, owner, repo, username string, ...) error
- func (p *Provider) AddDeployKey(ctx context.Context, owner, repo string, opts provider.AddDeployKeyOptions) (*provider.DeployKey, error)
- func (p *Provider) AddIssueCommentReaction(ctx context.Context, owner, repo string, commentID int64, emoji string) (*provider.Reaction, error)
- func (p *Provider) AddIssueLabels(ctx context.Context, owner, repo, number string, labels []string) error
- func (p *Provider) AddIssueReaction(ctx context.Context, owner, repo, number, emoji string) (*provider.Reaction, error)
- func (p *Provider) Capabilities() provider.CapabilitySet
- func (p *Provider) CloseCR(ctx context.Context, owner, repo, number string) (*provider.ChangeRequest, error)
- func (p *Provider) CloseIssue(ctx context.Context, owner, repo, number string) (*provider.Issue, error)
- func (p *Provider) CompareCommits(ctx context.Context, owner, repo, base, head string) (*provider.CompareResult, error)
- func (p *Provider) CreateBranch(ctx context.Context, owner, repo, branch, ref string) (*provider.PlatformBranch, error)
- func (p *Provider) CreateBranchProtection(ctx context.Context, owner, repo string, ...) (*provider.BranchProtection, error)
- func (p *Provider) CreateCR(ctx context.Context, opts provider.CreateCROptions) (*provider.ChangeRequest, error)
- func (p *Provider) CreateCommitStatus(ctx context.Context, owner, repo, sha string, ...) error
- func (p *Provider) CreateDiscussion(ctx context.Context, owner, repo, number string, ...) (string, error)
- func (p *Provider) CreateFile(ctx context.Context, owner, repo string, opts provider.FileOptions) (*provider.FileResult, error)
- func (p *Provider) CreateIssue(ctx context.Context, opts provider.CreateIssueOptions) (*provider.Issue, error)
- func (p *Provider) CreateIssueComment(ctx context.Context, owner, repo, number, body string) (*provider.IssueComment, error)
- func (p *Provider) CreateLabel(ctx context.Context, owner, repo string, opts provider.CreateLabelOptions) (*provider.Label, error)
- func (p *Provider) CreateMigration(ctx context.Context, org string, opts provider.CreateMigrationOptions) (*provider.MigrationInfo, error)
- func (p *Provider) CreateMilestone(ctx context.Context, owner, repo string, opts provider.CreateMilestoneOptions) (*provider.Milestone, error)
- func (p *Provider) CreateNote(ctx context.Context, owner, repo, number, body string) (string, error)
- func (p *Provider) CreateRelease(ctx context.Context, owner, repo string, opts provider.CreateReleaseOptions) (*provider.ReleaseInfo, error)
- func (p *Provider) CreateRepo(ctx context.Context, owner string, opts provider.CreateRepoOptions) (*provider.PlatformRepo, error)
- func (p *Provider) CreateReview(ctx context.Context, owner, repo, number string, ...) (*provider.ReviewResult, error)
- func (p *Provider) CreateWebhook(ctx context.Context, opts provider.CreateWebhookOptions) (*provider.PlatformWebhook, error)
- func (p *Provider) DeleteBranch(ctx context.Context, owner, repo, branch string) error
- func (p *Provider) DeleteBranchProtection(ctx context.Context, owner, repo, branch string) error
- func (p *Provider) DeleteDeployKey(ctx context.Context, owner, repo string, keyID int64) error
- func (p *Provider) DeleteFile(ctx context.Context, owner, repo string, opts provider.FileDeleteOptions) (*provider.FileResult, error)
- func (p *Provider) DeleteLabel(ctx context.Context, owner, repo, name string) error
- func (p *Provider) DeleteMilestone(ctx context.Context, owner, repo, number string) error
- func (p *Provider) DeleteNote(ctx context.Context, owner, repo, number, noteID string) error
- func (p *Provider) DeleteRelease(ctx context.Context, owner, repo, tag string) error
- func (p *Provider) DeleteRepo(ctx context.Context, owner, repo string) error
- func (p *Provider) DeleteWebhook(ctx context.Context, owner, repo string, webhookID int64) error
- func (p *Provider) DismissReview(ctx context.Context, owner, repo, number string, reviewID int64, ...) error
- func (p *Provider) Divergences() []provider.Divergence
- func (p *Provider) DownloadReleaseAsset(ctx context.Context, owner, repo string, assetID int64, w io.Writer) error
- func (p *Provider) ForkRepo(ctx context.Context, owner, repo string, opts provider.ForkRepoOptions) (*provider.PlatformRepo, error)
- func (p *Provider) GetArchive(ctx context.Context, owner, repo, ref, format string) ([]byte, error)
- func (p *Provider) GetBranchProtection(ctx context.Context, owner, repo, branch string) (*provider.BranchProtection, error)
- func (p *Provider) GetCR(ctx context.Context, owner, repo, number string) (*provider.ChangeRequest, error)
- func (p *Provider) GetCRDiff(ctx context.Context, owner, repo, number string) (*provider.MergeDiff, error)
- func (p *Provider) GetCRFiles(ctx context.Context, owner, repo, number string) ([]*provider.ChangedFile, error)
- func (p *Provider) GetCommit(ctx context.Context, owner, repo, sha string) (*provider.CommitInfo, error)
- func (p *Provider) GetFileContent(ctx context.Context, owner, repo, path, ref string) (string, error)
- func (p *Provider) GetIssue(ctx context.Context, owner, repo, number string) (*provider.Issue, error)
- func (p *Provider) GetMigration(ctx context.Context, org string, id int64) (*provider.MigrationInfo, error)
- func (p *Provider) GetMilestone(ctx context.Context, owner, repo, number string) (*provider.Milestone, error)
- func (p *Provider) GetReleaseByTag(ctx context.Context, owner, repo, tag string) (*provider.ReleaseInfo, error)
- func (p *Provider) GetRepo(ctx context.Context, owner, repo string) (*provider.PlatformRepo, error)
- func (p *Provider) GetReview(ctx context.Context, owner, repo, number string, reviewID int64) (*provider.Review, error)
- func (p *Provider) ListBranchProtections(ctx context.Context, owner, repo string) ([]*provider.BranchProtection, error)
- func (p *Provider) ListBranches(ctx context.Context, owner, repo string) ([]*provider.PlatformBranch, error)
- func (p *Provider) ListCRCommentReactions(ctx context.Context, owner, repo string, commentID int64) ([]*provider.Reaction, error)
- func (p *Provider) ListCRComments(ctx context.Context, owner, repo, number string) ([]*provider.CRComment, error)
- func (p *Provider) ListCRCommits(ctx context.Context, owner, repo, number string) ([]*provider.CRCommit, error)
- func (p *Provider) ListCRReactions(ctx context.Context, owner, repo, number string) ([]*provider.Reaction, error)
- func (p *Provider) ListCRs(ctx context.Context, opts provider.ListCROptions) ([]*provider.ChangeRequest, *int, error)
- func (p *Provider) ListCollaborators(ctx context.Context, owner, repo string) ([]*provider.Collaborator, error)
- func (p *Provider) ListCommitStatuses(ctx context.Context, owner, repo, sha string) ([]provider.CommitStatus, error)
- func (p *Provider) ListCommits(ctx context.Context, owner, repo string, opts provider.ListCommitsOptions) ([]*provider.CommitInfo, error)
- func (p *Provider) ListContributors(ctx context.Context, owner, repo string) ([]*provider.Contributor, error)
- func (p *Provider) ListDeployKeys(ctx context.Context, owner, repo string) ([]*provider.DeployKey, error)
- func (p *Provider) ListForks(ctx context.Context, owner, repo string) ([]*provider.PlatformRepo, error)
- func (p *Provider) ListIssueCommentReactions(ctx context.Context, owner, repo string, commentID int64) ([]*provider.Reaction, error)
- func (p *Provider) ListIssueComments(ctx context.Context, owner, repo, number string) ([]*provider.IssueComment, error)
- func (p *Provider) ListIssueLabels(ctx context.Context, owner, repo string) ([]*provider.IssueLabel, error)
- func (p *Provider) ListIssueReactions(ctx context.Context, owner, repo, number string) ([]*provider.Reaction, error)
- func (p *Provider) ListIssues(ctx context.Context, opts provider.ListIssuesOptions) ([]*provider.Issue, int, error)
- func (p *Provider) ListLabels(ctx context.Context, owner, repo string, opts provider.ListLabelsOptions) ([]*provider.Label, error)
- func (p *Provider) ListMilestones(ctx context.Context, owner, repo string, opts provider.ListMilestonesOptions) ([]provider.Milestone, error)
- func (p *Provider) ListMyGists(ctx context.Context, page, perPage int) ([]*provider.Gist, error)
- func (p *Provider) ListNotifications(ctx context.Context, opts provider.ListNotificationsOptions) ([]*provider.Notification, error)
- func (p *Provider) ListReleases(ctx context.Context, owner, repo string) ([]*provider.ReleaseInfo, error)
- func (p *Provider) ListRepoNotifications(ctx context.Context, owner, repo string, ...) ([]*provider.Notification, error)
- func (p *Provider) ListRepos(ctx context.Context, opts provider.ListRepoOptions) ([]*provider.PlatformRepo, error)
- func (p *Provider) ListReviews(ctx context.Context, owner, repo, number string) ([]provider.Review, error)
- func (p *Provider) ListStargazers(ctx context.Context, owner, repo string) ([]*provider.CRUser, error)
- func (p *Provider) ListStarred(ctx context.Context, page, perPage int) ([]*provider.PlatformRepo, error)
- func (p *Provider) ListTags(ctx context.Context, owner, repo string) ([]*provider.TagInfo, error)
- func (p *Provider) ListWebhooks(ctx context.Context, owner, repo string) ([]*provider.PlatformWebhook, error)
- func (p *Provider) MarkNotificationRead(ctx context.Context, threadID string) error
- func (p *Provider) MarkNotificationsRead(ctx context.Context, opts provider.MarkNotificationsOptions) error
- func (p *Provider) MarkRepoNotificationsRead(ctx context.Context, owner, repo string, ...) error
- func (p *Provider) MergeCR(ctx context.Context, owner, repo, number string, opts provider.MergeCROptions) (*provider.ChangeRequest, error)
- func (p *Provider) ParseWebhookEvent(r *http.Request, secret string) (*provider.NormalizedEvent, error)
- func (p *Provider) Platform() provider.Platform
- func (p *Provider) RemoveCRCommentReaction(ctx context.Context, owner, repo string, commentID, reactionID int64) error
- func (p *Provider) RemoveCollaborator(ctx context.Context, owner, repo, username string) error
- func (p *Provider) RemoveIssueCommentReaction(ctx context.Context, owner, repo string, commentID, reactionID int64) error
- func (p *Provider) RemoveIssueLabel(ctx context.Context, owner, repo, number, name string) error
- func (p *Provider) RemoveIssueReaction(ctx context.Context, owner, repo, number string, reactionID int64) error
- func (p *Provider) ReopenCR(ctx context.Context, owner, repo, number string) (*provider.ChangeRequest, error)
- func (p *Provider) ReopenIssue(ctx context.Context, owner, repo, number string) (*provider.Issue, error)
- func (p *Provider) RequestReviewers(ctx context.Context, owner, repo, number string, reviewers []string) error
- func (p *Provider) SearchIssues(ctx context.Context, opts provider.SearchIssuesOptions) ([]*provider.SearchIssueResult, *int, error)
- func (p *Provider) SearchRepos(ctx context.Context, opts provider.SearchReposOptions) ([]*provider.SearchRepoResult, *int, error)
- func (p *Provider) SearchUsers(ctx context.Context, opts provider.SearchUsersOptions) ([]*provider.SearchUserResult, *int, error)
- func (p *Provider) TestConnection(ctx context.Context) (*provider.TestConnectionResult, error)
- func (p *Provider) UpdateBranchProtection(ctx context.Context, owner, repo, branch string, ...) (*provider.BranchProtection, error)
- func (p *Provider) UpdateCR(ctx context.Context, owner, repo, number string, opts provider.UpdateCROptions) (*provider.ChangeRequest, error)
- func (p *Provider) UpdateCRLabels(ctx context.Context, owner, repo, number string, labels []string) error
- func (p *Provider) UpdateFile(ctx context.Context, owner, repo string, opts provider.FileOptions) (*provider.FileResult, error)
- func (p *Provider) UpdateIssue(ctx context.Context, owner, repo, number string, ...) (*provider.Issue, error)
- func (p *Provider) UpdateIssueComment(ctx context.Context, owner, repo, number string, commentID int64, body string) (*provider.IssueComment, error)
- func (p *Provider) UpdateLabel(ctx context.Context, owner, repo, name string, ...) (*provider.Label, error)
- func (p *Provider) UpdateMilestone(ctx context.Context, owner, repo, number string, ...) (*provider.Milestone, error)
- func (p *Provider) UpdateRelease(ctx context.Context, owner, repo, tag string, ...) (*provider.ReleaseInfo, error)
- func (p *Provider) UpdateRepo(ctx context.Context, owner, repo string, opts provider.UpdateRepoOptions) (*provider.PlatformRepo, error)
- func (p *Provider) ValidateWebhookSignature(r *http.Request, secret string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Divergences ¶
func Divergences() []provider.Divergence
Divergences returns the registered divergence ledger for the GitHub backend.
Types ¶
type Provider ¶
type Provider struct {
// contains filtered or unexported fields
}
Provider is the GitHub implementation of provider.Provider. It embeds the official go-github client and an auxiliary transport.Client used for endpoints not covered by the SDK (e.g. archive downloads).
func (*Provider) AddCRCommentReaction ¶
func (p *Provider) AddCRCommentReaction(ctx context.Context, owner, repo string, commentID int64, emoji string) (*provider.Reaction, error)
AddCRCommentReaction implements provider.ReactionManager.
func (*Provider) AddCollaborator ¶
func (p *Provider) AddCollaborator(ctx context.Context, owner, repo, username string, opts provider.AddCollaboratorOptions) error
AddCollaborator implements provider.CollaboratorManager.
func (*Provider) AddDeployKey ¶
func (p *Provider) AddDeployKey(ctx context.Context, owner, repo string, opts provider.AddDeployKeyOptions) (*provider.DeployKey, error)
AddDeployKey implements provider.DeploymentKeyManager.
func (*Provider) AddIssueCommentReaction ¶
func (p *Provider) AddIssueCommentReaction(ctx context.Context, owner, repo string, commentID int64, emoji string) (*provider.Reaction, error)
AddIssueCommentReaction implements provider.ReactionManager.
func (*Provider) AddIssueLabels ¶
func (p *Provider) AddIssueLabels(ctx context.Context, owner, repo, number string, labels []string) error
AddIssueLabels implements provider.IssueManager.
func (*Provider) AddIssueReaction ¶
func (p *Provider) AddIssueReaction(ctx context.Context, owner, repo, number, emoji string) (*provider.Reaction, error)
AddIssueReaction implements provider.ReactionManager.
func (*Provider) Capabilities ¶
func (p *Provider) Capabilities() provider.CapabilitySet
Capabilities implements provider.Provider. GitHub implements the optional LabelManager interface (see labels.go), the IssueManager interface (see issues.go), the ReviewManager interface (see reviews.go), the SearchManager interface (see search.go), and the GitHub-only capabilities GistManager (gists.go), StarredManager (starred.go), MigrationManager (migrations.go), and ReleaseAssetManager (release_assets.go).
func (*Provider) CloseCR ¶
func (p *Provider) CloseCR(ctx context.Context, owner, repo, number string) (*provider.ChangeRequest, error)
CloseCR implements provider.ChangeRequestManager.
func (*Provider) CloseIssue ¶
func (p *Provider) CloseIssue(ctx context.Context, owner, repo, number string) (*provider.Issue, error)
CloseIssue implements provider.IssueManager.
func (*Provider) CompareCommits ¶
func (p *Provider) CompareCommits(ctx context.Context, owner, repo, base, head string) (*provider.CompareResult, error)
CompareCommits implements provider.CommitManager.
func (*Provider) CreateBranch ¶
func (p *Provider) CreateBranch(ctx context.Context, owner, repo, branch, ref string) (*provider.PlatformBranch, error)
CreateBranch implements provider.BranchManager.
func (*Provider) CreateBranchProtection ¶
func (p *Provider) CreateBranchProtection(ctx context.Context, owner, repo string, opts provider.CreateBranchProtectionOptions) (*provider.BranchProtection, error)
CreateBranchProtection implements provider.BranchProtectionManager. GitHub has no dedicated create endpoint; this delegates to UpdateBranchProtection.
func (*Provider) CreateCR ¶
func (p *Provider) CreateCR(ctx context.Context, opts provider.CreateCROptions) (*provider.ChangeRequest, error)
CreateCR implements provider.ChangeRequestManager.
func (*Provider) CreateCommitStatus ¶
func (p *Provider) CreateCommitStatus(ctx context.Context, owner, repo, sha string, opts provider.CommitStatusOptions) error
CreateCommitStatus implements provider.CommitStatusManager.
func (*Provider) CreateDiscussion ¶
func (p *Provider) CreateDiscussion(ctx context.Context, owner, repo, number string, opts provider.DiscussionOptions) (string, error)
CreateDiscussion implements provider.DiffManager.
func (*Provider) CreateFile ¶
func (p *Provider) CreateFile(ctx context.Context, owner, repo string, opts provider.FileOptions) (*provider.FileResult, error)
CreateFile implements provider.FileManager.
func (*Provider) CreateIssue ¶
func (p *Provider) CreateIssue(ctx context.Context, opts provider.CreateIssueOptions) (*provider.Issue, error)
CreateIssue implements provider.IssueManager.
func (*Provider) CreateIssueComment ¶
func (p *Provider) CreateIssueComment(ctx context.Context, owner, repo, number, body string) (*provider.IssueComment, error)
CreateIssueComment implements provider.IssueManager.
func (*Provider) CreateLabel ¶
func (p *Provider) CreateLabel(ctx context.Context, owner, repo string, opts provider.CreateLabelOptions) (*provider.Label, error)
CreateLabel implements provider.LabelManager.
func (*Provider) CreateMigration ¶ added in v0.72.0
func (p *Provider) CreateMigration(ctx context.Context, org string, opts provider.CreateMigrationOptions) (*provider.MigrationInfo, error)
CreateMigration implements provider.MigrationManager. go-github 的 MigrationService 只覆盖组织级端点(orgs/{org}/migrations 且请求体不含 exclude_metadata),而消费方需要 user/org 两条路径共用同一请求体 (lock_repositories + exclude_metadata),因此自行构造请求。 org == "" → POST /user/migrations(用户级),非空 → POST /orgs/{org}/migrations。
func (*Provider) CreateMilestone ¶
func (p *Provider) CreateMilestone(ctx context.Context, owner, repo string, opts provider.CreateMilestoneOptions) (*provider.Milestone, error)
CreateMilestone implements provider.MilestoneManager.
func (*Provider) CreateNote ¶
func (p *Provider) CreateNote(ctx context.Context, owner, repo, number, body string) (string, error)
CreateNote implements provider.DiffManager.
func (*Provider) CreateRelease ¶
func (p *Provider) CreateRelease(ctx context.Context, owner, repo string, opts provider.CreateReleaseOptions) (*provider.ReleaseInfo, error)
CreateRelease implements provider.ReleaseManager.
func (*Provider) CreateRepo ¶
func (p *Provider) CreateRepo(ctx context.Context, owner string, opts provider.CreateRepoOptions) (*provider.PlatformRepo, error)
CreateRepo implements provider.RepoManager.
func (*Provider) CreateReview ¶
func (p *Provider) CreateReview(ctx context.Context, owner, repo, number string, opts provider.CreateReviewOptions) (*provider.ReviewResult, error)
CreateReview implements provider.ReviewManager. It moved here from DiffManager; the change request number is now addressed as a string.
func (*Provider) CreateWebhook ¶
func (p *Provider) CreateWebhook(ctx context.Context, opts provider.CreateWebhookOptions) (*provider.PlatformWebhook, error)
CreateWebhook implements provider.WebhookManager.
func (*Provider) DeleteBranch ¶
DeleteBranch implements provider.BranchManager.
func (*Provider) DeleteBranchProtection ¶
DeleteBranchProtection implements provider.BranchProtectionManager.
func (*Provider) DeleteDeployKey ¶
DeleteDeployKey implements provider.DeploymentKeyManager.
func (*Provider) DeleteFile ¶
func (p *Provider) DeleteFile(ctx context.Context, owner, repo string, opts provider.FileDeleteOptions) (*provider.FileResult, error)
DeleteFile implements provider.FileManager.
func (*Provider) DeleteLabel ¶
DeleteLabel implements provider.LabelManager.
func (*Provider) DeleteMilestone ¶
DeleteMilestone implements provider.MilestoneManager.
func (*Provider) DeleteNote ¶
DeleteNote implements provider.DiffManager. The note itself is addressed by its numeric platform ID; the change-request number is only validated, as GitHub's delete-comment endpoint does not take it.
func (*Provider) DeleteRelease ¶
DeleteRelease implements provider.ReleaseManager. The delete endpoint is id-addressed; the tag is resolved through the by-tag endpoint first.
func (*Provider) DeleteRepo ¶
DeleteRepo implements provider.RepoManager.
func (*Provider) DeleteWebhook ¶
DeleteWebhook implements provider.WebhookManager.
func (*Provider) DismissReview ¶
func (p *Provider) DismissReview(ctx context.Context, owner, repo, number string, reviewID int64, message string) error
DismissReview implements provider.ReviewManager.
func (*Provider) Divergences ¶
func (p *Provider) Divergences() []provider.Divergence
Divergences implements provider.Provider.
func (*Provider) DownloadReleaseAsset ¶ added in v0.72.0
func (p *Provider) DownloadReleaseAsset(ctx context.Context, owner, repo string, assetID int64, w io.Writer) error
DownloadReleaseAsset implements provider.ReleaseAssetManager.
SDK 内部用 bareDoUntilFound 处理资产端点的 302(GitHub 对 Accept: application/octet-stream 返回重定向而非直接字节流),302 目标 是签名 URL:必须用无鉴权的裸 client 跟随,不能复用 SDK 自己的 http.Client(其 CheckRedirect 被禁用)也不该带上 API Bearer。跟随用 p.followClient —— 同 SkipTLS 策略,GHES 自签场景第二跳不再 x509。 跟随后的响应体经 CheckResponse 校验,非 2xx 直接报错;rc 即字节流, io.Copy 流式写入 w,不整读内存。
func (*Provider) ForkRepo ¶
func (p *Provider) ForkRepo(ctx context.Context, owner, repo string, opts provider.ForkRepoOptions) (*provider.PlatformRepo, error)
ForkRepo implements provider.RepoManager.
func (*Provider) GetArchive ¶
GetArchive implements provider.ReleaseManager.
func (*Provider) GetBranchProtection ¶
func (p *Provider) GetBranchProtection(ctx context.Context, owner, repo, branch string) (*provider.BranchProtection, error)
GetBranchProtection implements provider.BranchProtectionManager.
func (*Provider) GetCR ¶
func (p *Provider) GetCR(ctx context.Context, owner, repo, number string) (*provider.ChangeRequest, error)
GetCR implements provider.ChangeRequestManager.
func (*Provider) GetCRDiff ¶
func (p *Provider) GetCRDiff(ctx context.Context, owner, repo, number string) (*provider.MergeDiff, error)
GetCRDiff implements provider.DiffManager.
func (*Provider) GetCRFiles ¶
func (p *Provider) GetCRFiles(ctx context.Context, owner, repo, number string) ([]*provider.ChangedFile, error)
GetCRFiles implements provider.DiffManager.
func (*Provider) GetCommit ¶
func (p *Provider) GetCommit(ctx context.Context, owner, repo, sha string) (*provider.CommitInfo, error)
GetCommit implements provider.CommitManager.
func (*Provider) GetFileContent ¶
func (p *Provider) GetFileContent(ctx context.Context, owner, repo, path, ref string) (string, error)
GetFileContent implements provider.FileManager.
func (*Provider) GetIssue ¶
func (p *Provider) GetIssue(ctx context.Context, owner, repo, number string) (*provider.Issue, error)
GetIssue implements provider.IssueManager.
func (*Provider) GetMigration ¶ added in v0.72.0
func (p *Provider) GetMigration(ctx context.Context, org string, id int64) (*provider.MigrationInfo, error)
GetMigration implements provider.MigrationManager. org 语义与 CreateMigration 一致:"" 走 GET /user/migrations/{id},非空走 GET /orgs/{org}/migrations/{id}(消费方轮询到 exported/failed 终态)。
func (*Provider) GetMilestone ¶
func (p *Provider) GetMilestone(ctx context.Context, owner, repo, number string) (*provider.Milestone, error)
GetMilestone implements provider.MilestoneManager.
func (*Provider) GetReleaseByTag ¶
func (p *Provider) GetReleaseByTag(ctx context.Context, owner, repo, tag string) (*provider.ReleaseInfo, error)
GetReleaseByTag implements provider.ReleaseManager. GitHub exposes a dedicated tag-addressed endpoint, so no id resolution is needed.
func (*Provider) GetReview ¶
func (p *Provider) GetReview(ctx context.Context, owner, repo, number string, reviewID int64) (*provider.Review, error)
GetReview implements provider.ReviewManager.
func (*Provider) ListBranchProtections ¶
func (p *Provider) ListBranchProtections(ctx context.Context, owner, repo string) ([]*provider.BranchProtection, error)
ListBranchProtections implements provider.BranchProtectionManager. GitHub has no list endpoint for branch protections; this returns nil.
func (*Provider) ListBranches ¶
func (p *Provider) ListBranches(ctx context.Context, owner, repo string) ([]*provider.PlatformBranch, error)
ListBranches implements provider.BranchManager. The provider interface exposes no paging parameters, so pagination is exhausted via backendutil.AllPages (100 per page until the platform returns an empty page) instead of silently truncating at the first page.
func (*Provider) ListCRCommentReactions ¶
func (p *Provider) ListCRCommentReactions(ctx context.Context, owner, repo string, commentID int64) ([]*provider.Reaction, error)
ListCRCommentReactions implements provider.ReactionManager. The provider interface exposes no paging parameters, so pagination is exhausted via backendutil.AllPages (100 per page until an empty page).
func (*Provider) ListCRComments ¶
func (p *Provider) ListCRComments(ctx context.Context, owner, repo, number string) ([]*provider.CRComment, error)
ListCRComments implements provider.ChangeRequestManager. The provider interface exposes no paging parameters, so pagination is exhausted via backendutil.AllPages (100 per page until an empty page).
func (*Provider) ListCRCommits ¶
func (p *Provider) ListCRCommits(ctx context.Context, owner, repo, number string) ([]*provider.CRCommit, error)
ListCRCommits implements provider.ChangeRequestManager. The provider interface exposes no paging parameters, so pagination is exhausted via backendutil.AllPages (100 per page until an empty page).
func (*Provider) ListCRReactions ¶
func (p *Provider) ListCRReactions(ctx context.Context, owner, repo, number string) ([]*provider.Reaction, error)
ListCRReactions implements provider.ReactionManager. On GitHub, PRs share the issue reactions API. The provider interface exposes no paging parameters, so pagination is exhausted via backendutil.AllPages (100 per page until an empty page).
func (*Provider) ListCRs ¶
func (p *Provider) ListCRs(ctx context.Context, opts provider.ListCROptions) ([]*provider.ChangeRequest, *int, error)
ListCRs implements provider.ChangeRequestManager.
func (*Provider) ListCollaborators ¶
func (p *Provider) ListCollaborators(ctx context.Context, owner, repo string) ([]*provider.Collaborator, error)
ListCollaborators implements provider.CollaboratorManager. The provider interface exposes no paging parameters, so pagination is exhausted via backendutil.AllPages (100 per page until an empty page).
func (*Provider) ListCommitStatuses ¶
func (p *Provider) ListCommitStatuses(ctx context.Context, owner, repo, sha string) ([]provider.CommitStatus, error)
ListCommitStatuses implements provider.CommitStatusManager.
func (*Provider) ListCommits ¶
func (p *Provider) ListCommits(ctx context.Context, owner, repo string, opts provider.ListCommitsOptions) ([]*provider.CommitInfo, error)
ListCommits implements provider.CommitManager.
Dual pagination mode: opts.Page > 0 means the caller manages paging explicitly and receives exactly that one page (opts.Page/opts.PerPage honored via NormalizePageOpts); opts.Page == 0 (the default) exhausts pagination via backendutil.AllPages — fetching 100 per page until an empty page — so every matching commit is returned. In full-fetch mode opts.PerPage only sizes the underlying requests and defaults to the platform maximum of 100.
func (*Provider) ListContributors ¶
func (p *Provider) ListContributors(ctx context.Context, owner, repo string) ([]*provider.Contributor, error)
ListContributors implements provider.RepoStatsManager. The provider interface exposes no paging parameters, so pagination is exhausted via backendutil.AllPages (100 per page until an empty page).
func (*Provider) ListDeployKeys ¶
func (p *Provider) ListDeployKeys(ctx context.Context, owner, repo string) ([]*provider.DeployKey, error)
ListDeployKeys implements provider.DeploymentKeyManager. The provider interface exposes no paging parameters, so pagination is exhausted via backendutil.AllPages (100 per page until an empty page).
func (*Provider) ListForks ¶
func (p *Provider) ListForks(ctx context.Context, owner, repo string) ([]*provider.PlatformRepo, error)
ListForks implements provider.RepoStatsManager. The provider interface exposes no paging parameters, so pagination is exhausted via backendutil.AllPages (100 per page until an empty page).
func (*Provider) ListIssueCommentReactions ¶
func (p *Provider) ListIssueCommentReactions(ctx context.Context, owner, repo string, commentID int64) ([]*provider.Reaction, error)
ListIssueCommentReactions implements provider.ReactionManager. The provider interface exposes no paging parameters, so pagination is exhausted via backendutil.AllPages (100 per page until an empty page).
func (*Provider) ListIssueComments ¶
func (p *Provider) ListIssueComments(ctx context.Context, owner, repo, number string) ([]*provider.IssueComment, error)
ListIssueComments implements provider.IssueManager.
func (*Provider) ListIssueLabels ¶
func (p *Provider) ListIssueLabels(ctx context.Context, owner, repo string) ([]*provider.IssueLabel, error)
ListIssueLabels implements provider.IssueManager: repository-level labels, exhausting pagination (the loop advances until an empty page).
func (*Provider) ListIssueReactions ¶
func (p *Provider) ListIssueReactions(ctx context.Context, owner, repo, number string) ([]*provider.Reaction, error)
ListIssueReactions implements provider.ReactionManager. The provider interface exposes no paging parameters, so pagination is exhausted via backendutil.AllPages (100 per page until an empty page).
func (*Provider) ListIssues ¶
func (p *Provider) ListIssues(ctx context.Context, opts provider.ListIssuesOptions) ([]*provider.Issue, int, error)
ListIssues implements provider.IssueManager.
func (*Provider) ListLabels ¶
func (p *Provider) ListLabels(ctx context.Context, owner, repo string, opts provider.ListLabelsOptions) ([]*provider.Label, error)
ListLabels implements provider.LabelManager.
Dual pagination mode: opts.Page > 0 means the caller manages paging explicitly and receives exactly that one page (opts.Page/opts.PerPage honored via NormalizePageOpts); opts.Page == 0 (the default) exhausts pagination via backendutil.AllPages — fetching 100 per page until an empty page — so every label is returned.
func (*Provider) ListMilestones ¶
func (p *Provider) ListMilestones(ctx context.Context, owner, repo string, opts provider.ListMilestonesOptions) ([]provider.Milestone, error)
ListMilestones implements provider.MilestoneManager. State filters by "open"/"closed" (GitHub also accepts "all"); GitHub defaults to open.
Dual pagination mode: opts.Page > 0 means the caller manages paging explicitly and receives exactly that one page (opts.Page/opts.PerPage honored via NormalizePageOpts); opts.Page == 0 (the default) exhausts pagination via backendutil.AllPages — fetching 100 per page until an empty page — so every matching milestone is returned.
func (*Provider) ListMyGists ¶ added in v0.72.0
ListMyGists implements provider.GistManager. user 传空字符串时 go-github 走 GET /gists——已认证调用返回的是 token 用户自己的 gist 列表(而非全站 公开 gist),正是备份场景要的「token 用户可见列表」。
func (*Provider) ListNotifications ¶
func (p *Provider) ListNotifications(ctx context.Context, opts provider.ListNotificationsOptions) ([]*provider.Notification, error)
ListNotifications implements provider.NotificationManager.
Dual pagination mode: opts.Page > 0 means the caller manages paging explicitly and receives exactly that one page (opts.Page/opts.PerPage honored via NormalizePageOpts); opts.Page == 0 (the default) exhausts pagination via backendutil.AllPages — fetching 100 per page until an empty page — so every matching notification is returned.
func (*Provider) ListReleases ¶
func (p *Provider) ListReleases(ctx context.Context, owner, repo string) ([]*provider.ReleaseInfo, error)
ListReleases implements provider.ReleaseManager. The provider interface exposes no paging parameters, so pagination is exhausted via backendutil.AllPages (100 per page until an empty page).
func (*Provider) ListRepoNotifications ¶
func (p *Provider) ListRepoNotifications(ctx context.Context, owner, repo string, opts provider.ListNotificationsOptions) ([]*provider.Notification, error)
ListRepoNotifications implements provider.NotificationManager.
Dual pagination mode, mirroring ListNotifications: opts.Page > 0 returns exactly that one caller-managed page; opts.Page == 0 exhausts pagination via backendutil.AllPages.
func (*Provider) ListRepos ¶
func (p *Provider) ListRepos(ctx context.Context, opts provider.ListRepoOptions) ([]*provider.PlatformRepo, error)
ListRepos implements provider.RepoManager.
func (*Provider) ListReviews ¶
func (p *Provider) ListReviews(ctx context.Context, owner, repo, number string) ([]provider.Review, error)
ListReviews implements provider.ReviewManager. The provider interface exposes no paging parameters, so pagination is exhausted via backendutil.AllPages (100 per page until an empty page).
func (*Provider) ListStargazers ¶
func (p *Provider) ListStargazers(ctx context.Context, owner, repo string) ([]*provider.CRUser, error)
ListStargazers implements provider.RepoStatsManager. The provider interface exposes no paging parameters, so pagination is exhausted via backendutil.AllPages (100 per page until an empty page).
func (*Provider) ListStarred ¶ added in v0.72.0
func (p *Provider) ListStarred(ctx context.Context, page, perPage int) ([]*provider.PlatformRepo, error)
ListStarred implements provider.StarredManager.
GET /user/starred 有两种响应形状:Accept 带 star+json 时返回 [{starred_at, repo:{...}}] 包裹形状,否则返回裸 repo 数组。SDK 的 Activity.ListStarred 固定请求包裹形状——服务端一旦返回裸列表(代理改写 Accept、GHES 版本差异),SDK 会把每项解成空 Repository。因此这里自行 构造请求并逐元素探测两种形状,保证兼容;Accept 仍请求 star+json,与 消费方(下游 org_mirror)的线上行为一致。
func (*Provider) ListTags ¶
ListTags implements provider.ReleaseManager. The provider interface exposes no paging parameters, so pagination is exhausted via backendutil.AllPages (100 per page until an empty page).
func (*Provider) ListWebhooks ¶
func (p *Provider) ListWebhooks(ctx context.Context, owner, repo string) ([]*provider.PlatformWebhook, error)
ListWebhooks implements provider.WebhookManager. The provider interface exposes no paging parameters, so pagination is exhausted via backendutil.AllPages (100 per page until an empty page).
func (*Provider) MarkNotificationRead ¶
MarkNotificationRead implements provider.NotificationManager.
func (*Provider) MarkNotificationsRead ¶
func (p *Provider) MarkNotificationsRead(ctx context.Context, opts provider.MarkNotificationsOptions) error
MarkNotificationsRead implements provider.NotificationManager.
func (*Provider) MarkRepoNotificationsRead ¶
func (p *Provider) MarkRepoNotificationsRead(ctx context.Context, owner, repo string, opts provider.MarkNotificationsOptions) error
MarkRepoNotificationsRead implements provider.NotificationManager.
func (*Provider) MergeCR ¶
func (p *Provider) MergeCR(ctx context.Context, owner, repo, number string, opts provider.MergeCROptions) (*provider.ChangeRequest, error)
MergeCR implements provider.ChangeRequestManager.
func (*Provider) ParseWebhookEvent ¶
func (p *Provider) ParseWebhookEvent(r *http.Request, secret string) (*provider.NormalizedEvent, error)
ParseWebhookEvent implements provider.WebhookManager.
func (*Provider) RemoveCRCommentReaction ¶
func (p *Provider) RemoveCRCommentReaction(ctx context.Context, owner, repo string, commentID, reactionID int64) error
RemoveCRCommentReaction implements provider.ReactionManager.
func (*Provider) RemoveCollaborator ¶
RemoveCollaborator implements provider.CollaboratorManager.
func (*Provider) RemoveIssueCommentReaction ¶
func (p *Provider) RemoveIssueCommentReaction(ctx context.Context, owner, repo string, commentID, reactionID int64) error
RemoveIssueCommentReaction implements provider.ReactionManager.
func (*Provider) RemoveIssueLabel ¶
RemoveIssueLabel implements provider.IssueManager.
func (*Provider) RemoveIssueReaction ¶
func (p *Provider) RemoveIssueReaction(ctx context.Context, owner, repo, number string, reactionID int64) error
RemoveIssueReaction implements provider.ReactionManager.
func (*Provider) ReopenCR ¶
func (p *Provider) ReopenCR(ctx context.Context, owner, repo, number string) (*provider.ChangeRequest, error)
ReopenCR implements provider.ChangeRequestManager.
func (*Provider) ReopenIssue ¶
func (p *Provider) ReopenIssue(ctx context.Context, owner, repo, number string) (*provider.Issue, error)
ReopenIssue implements provider.IssueManager.
func (*Provider) RequestReviewers ¶
func (p *Provider) RequestReviewers(ctx context.Context, owner, repo, number string, reviewers []string) error
RequestReviewers implements provider.ReviewManager.
func (*Provider) SearchIssues ¶
func (p *Provider) SearchIssues(ctx context.Context, opts provider.SearchIssuesOptions) ([]*provider.SearchIssueResult, *int, error)
SearchIssues implements provider.SearchManager. Repo/State map onto query qualifiers; "is:issue" keeps pull requests out of the results.
func (*Provider) SearchRepos ¶
func (p *Provider) SearchRepos(ctx context.Context, opts provider.SearchReposOptions) ([]*provider.SearchRepoResult, *int, error)
SearchRepos implements provider.SearchManager.
func (*Provider) SearchUsers ¶
func (p *Provider) SearchUsers(ctx context.Context, opts provider.SearchUsersOptions) ([]*provider.SearchUserResult, *int, error)
SearchUsers implements provider.SearchManager.
func (*Provider) TestConnection ¶
TestConnection implements provider.Provider.
func (*Provider) UpdateBranchProtection ¶
func (p *Provider) UpdateBranchProtection(ctx context.Context, owner, repo, branch string, opts provider.UpdateBranchProtectionOptions) (*provider.BranchProtection, error)
UpdateBranchProtection implements provider.BranchProtectionManager.
func (*Provider) UpdateCR ¶
func (p *Provider) UpdateCR(ctx context.Context, owner, repo, number string, opts provider.UpdateCROptions) (*provider.ChangeRequest, error)
UpdateCR implements provider.ChangeRequestManager.
func (*Provider) UpdateCRLabels ¶
func (p *Provider) UpdateCRLabels(ctx context.Context, owner, repo, number string, labels []string) error
UpdateCRLabels implements provider.ChangeRequestManager.
func (*Provider) UpdateFile ¶
func (p *Provider) UpdateFile(ctx context.Context, owner, repo string, opts provider.FileOptions) (*provider.FileResult, error)
UpdateFile implements provider.FileManager.
func (*Provider) UpdateIssue ¶
func (p *Provider) UpdateIssue(ctx context.Context, owner, repo, number string, opts provider.UpdateIssueOptions) (*provider.Issue, error)
UpdateIssue implements provider.IssueManager.
func (*Provider) UpdateIssueComment ¶
func (p *Provider) UpdateIssueComment(ctx context.Context, owner, repo, number string, commentID int64, body string) (*provider.IssueComment, error)
UpdateIssueComment implements provider.IssueManager. The edit endpoint addresses the comment directly, so number is unused. The platform only lets the comment's author perform the edit.
func (*Provider) UpdateLabel ¶
func (p *Provider) UpdateLabel(ctx context.Context, owner, repo, name string, opts provider.UpdateLabelOptions) (*provider.Label, error)
UpdateLabel implements provider.LabelManager. GitHub addresses labels by name; nil option fields are simply omitted from the PATCH body.
func (*Provider) UpdateMilestone ¶
func (p *Provider) UpdateMilestone(ctx context.Context, owner, repo, number string, opts provider.UpdateMilestoneOptions) (*provider.Milestone, error)
UpdateMilestone implements provider.MilestoneManager. Nil fields in opts stay absent from the PATCH body, leaving the milestone unchanged.
func (*Provider) UpdateRelease ¶
func (p *Provider) UpdateRelease(ctx context.Context, owner, repo, tag string, opts provider.UpdateReleaseOptions) (*provider.ReleaseInfo, error)
UpdateRelease implements provider.ReleaseManager. The update endpoint is id-addressed, so the tag is resolved through the by-tag endpoint first (exact lookup, no list window). go-github's UpdateReleaseRequest carries pointer fields, and GitHub's PATCH leaves omitted fields unchanged, so nil options pass through untouched.
func (*Provider) UpdateRepo ¶
func (p *Provider) UpdateRepo(ctx context.Context, owner, repo string, opts provider.UpdateRepoOptions) (*provider.PlatformRepo, error)
UpdateRepo implements provider.RepoManager.
func (*Provider) ValidateWebhookSignature ¶
ValidateWebhookSignature implements provider.WebhookManager. It delegates to the platform's registered validator so the signature scheme has exactly one implementation (shared with contracttest); notably an empty secret is rejected rather than silently accepted.