diff --git a/constants/event.go b/constants/event.go index c2ec26aad..ed5cd9224 100644 --- a/constants/event.go +++ b/constants/event.go @@ -28,6 +28,9 @@ const ( // EventTag defines the event type for build and repo tag events. EventTag = "tag" + // EventInstallation defines the event type for scm installation events. + EventInstallation = "installation" + // Alternates for common user inputs that do not match our set constants. // EventPullAlternate defines the alternate event type for build and repo pull_request events. diff --git a/docker-compose.yml b/docker-compose.yml index 28e235860..a96b4b87f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -52,8 +52,6 @@ services: restart: always ports: - '8080:8080' - # dlv - - '4000:4000' depends_on: postgres: condition: service_healthy diff --git a/scm/github/app_install.go b/scm/github/app_install.go index 2e2b709e3..58fa3517c 100644 --- a/scm/github/app_install.go +++ b/scm/github/app_install.go @@ -79,7 +79,7 @@ func updateRepoInstallationID(ctx context.Context, webhook *internal.Webhook, r h.SetWebhookID(webhook.Hook.GetWebhookID()) h.SetCreated(webhook.Hook.GetCreated()) h.SetHost(webhook.Hook.GetHost()) - h.SetEvent("installation") + h.SetEvent(constants.EventInstallation) h.SetStatus(webhook.Hook.GetStatus()) r, err := db.UpdateRepo(ctx, r) @@ -140,7 +140,7 @@ func updateRepoInstallationID(ctx context.Context, webhook *internal.Webhook, r // FinishInstallation completes the web flow for a GitHub App installation, returning a redirect to the app installation page. func (c *client) FinishInstallation(ctx context.Context, request *http.Request, installID int64) (string, error) { - c.Logger.Tracef("finishing GitHub App installation") + c.Logger.Tracef("finishing GitHub App installation for ID %d", installID) githubAppClient, err := c.newGithubAppClient(ctx) if err != nil { @@ -152,7 +152,5 @@ func (c *client) FinishInstallation(ctx context.Context, request *http.Request, return "", err } - r := install.GetHTMLURL() - - return r, nil + return install.GetHTMLURL(), nil } diff --git a/scm/github/repo.go b/scm/github/repo.go index 9b7e32c09..d4a16acf2 100644 --- a/scm/github/repo.go +++ b/scm/github/repo.go @@ -678,7 +678,7 @@ func (c *client) GetBranch(ctx context.Context, r *api.Repo, branch string) (str return data.GetName(), data.GetCommit().GetSHA(), nil } -// CreateChecks defines a function that does stuff... +// CreateChecks authenticates with the GitHub App and creates a check run for the repo. func (c *client) CreateChecks(ctx context.Context, r *api.Repo, commit, step, event string) (int64, error) { // create client from GitHub App t, err := c.newGithubAppInstallationRepoToken(ctx, r, []string{}, map[string]string{}) @@ -705,7 +705,7 @@ func (c *client) CreateChecks(ctx context.Context, r *api.Repo, commit, step, ev return check.GetID(), nil } -// UpdateChecks defines a function that does stuff... +// UpdateChecks authenticates with the GitHub App and updates a check run for the repo. func (c *client) UpdateChecks(ctx context.Context, r *api.Repo, s *api.Step, commit, event string) error { // create client from GitHub App t, err := c.newGithubAppInstallationRepoToken(ctx, r, []string{}, map[string]string{})