Documentation
¶
Index ¶
- func ConnectivityCheck() error
- func GetPullRequest(ctx context.Context, owner, repo string, prNum int) (scm.ChangeRequest, error)
- func ListPullRequestFiles(ctx context.Context, owner, repo string, prNum int) ([]string, error)
- func ProcessComment(payload []byte) (webhook.EventInfo, error)
- func ProcessPullRequest(payload []byte) (webhook.EventInfo, error)
- func Status(ctx context.Context, status scm.Status, ...) error
- func VerifySignature(payload []byte, headerSignature string, secret string) bool
- type Provider
- func (Provider) ConnectivityCheck() error
- func (Provider) CreateComment(ctx context.Context, repo scm.RepoRef, num int, body string) (scm.Comment, error)
- func (Provider) CredentialsHint() string
- func (Provider) CurrentUser(ctx context.Context) (string, error)
- func (Provider) DetectCI() bool
- func (Provider) Dialect() comment.Dialect
- func (Provider) Enabled() bool
- func (Provider) EventFromCIEnv() (webhook.EventInfo, error)
- func (Provider) GetChangeRequest(ctx context.Context, repo scm.RepoRef, num int) (scm.ChangeRequest, error)
- func (Provider) ListChangedFiles(ctx context.Context, repo scm.RepoRef, num int) ([]string, error)
- func (Provider) ListComments(ctx context.Context, repo scm.RepoRef, num int) ([]scm.Comment, error)
- func (Provider) Name() string
- func (Provider) RepoHosts() []string
- func (Provider) SetStatus(ctx context.Context, repo scm.RepoRef, sha string, state scm.Status, ...) error
- func (Provider) UpdateComment(ctx context.Context, repo scm.RepoRef, num int, id int64, body string) (scm.Comment, error)
- func (Provider) ValidateConfig() error
- func (Provider) WebhookHandler() scm.WebhookHandler
- type WebhookHandler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConnectivityCheck ¶
func ConnectivityCheck() error
func GetPullRequest ¶
GetPullRequest fetches the specified pull request. A branch the API did not return is left empty in the result; see scm.ChangeRequest.
func ListPullRequestFiles ¶
Returns list of files in a pull request
func ProcessComment ¶
Processes a comment created event received from github
func ProcessPullRequest ¶
Processes a pull_request event received from github
Types ¶
type Provider ¶
type Provider struct{}
Provider implements argo-diff's provider primitives on top of the GitHub API. It holds no state: the clients are package vars built in init(), which tests swap for httptest-backed ones.
func (Provider) ConnectivityCheck ¶
func (Provider) CreateComment ¶
func (Provider) CredentialsHint ¶
CredentialsHint names the variables that enable this provider.
func (Provider) CurrentUser ¶
CurrentUser returns the comment author's login. Under GitHub Actions, or with the github connectivity check bypassed, it returns "" so comments are matched by marker alone: the token's identity can't be resolved there.
func (Provider) Enabled ¶
Enabled reports whether any GitHub credential is set: a token, or any of the GitHub App variables. ValidateConfig() catches an incomplete App setup.
func (Provider) EventFromCIEnv ¶
EventFromCIEnv builds the event from the variables GitHub Actions sets for a pull_request workflow. Refresh is set, so the head SHA and refs are re-read from the API rather than trusted from the environment.
func (Provider) GetChangeRequest ¶
func (Provider) ListChangedFiles ¶
func (Provider) ListComments ¶
ListComments returns every comment on the pull request, oldest first.
func (Provider) RepoHosts ¶
RepoHosts is where GitHub repositories live, for matching ArgoCD application sources. GitHub Enterprise hosts match through argocd's host-agnostic owner/repo fallback.
func (Provider) SetStatus ¶
func (Provider) SetStatus(ctx context.Context, repo scm.RepoRef, sha string, state scm.Status, description string, dryRun bool) error
SetStatus is a no-op under GitHub Actions; see Status().
func (Provider) UpdateComment ¶
func (Provider) UpdateComment(ctx context.Context, repo scm.RepoRef, num int, id int64, body string) (scm.Comment, error)
UpdateComment edits an issue comment. GitHub addresses issue comments by ID alone, so num is unused.
func (Provider) ValidateConfig ¶
ValidateConfig requires all three GitHub App variables when no token is set.
func (Provider) WebhookHandler ¶
func (Provider) WebhookHandler() scm.WebhookHandler
type WebhookHandler ¶
type WebhookHandler struct{}
WebhookHandler verifies and parses GitHub webhook requests.
func (WebhookHandler) CheckConfig ¶
func (WebhookHandler) CheckConfig() error
CheckConfig requires GITHUB_WEBHOOK_SECRET, which Verify() needs.
func (WebhookHandler) Parse ¶
func (WebhookHandler) Parse(h http.Header, body []byte) (scm.WebhookEvent, error)
Parse handles ping, pull_request and issue_comment events; every other event type is reported as scm.WebhookIgnored.