diff --git a/README.md b/README.md index 51849f5..d44d23c 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,8 @@ AWS Lambda function. secret scanning alerts older than a threshold - **GitHub App installer** - Optionally create the GitHub App from a manifest with one click, using - [github-app-setup-go](https://github.com/cruxstack/github-app-setup-go) + [github-app-setup-go](https://github.com/cruxstack/github-app-setup-go), + and add its icon - **Slack notifications** - Reports for each feature, in per-feature channels - **Slack app setup** - Optionally create and install the Slack app from a setup page, with its slash command and icon diff --git a/assets/assets.go b/assets/assets.go index 4ab798c..f10d351 100644 --- a/assets/assets.go +++ b/assets/assets.go @@ -3,7 +3,8 @@ package assets import _ "embed" -// SlackIcon is the Slack app's icon, a 1024x1024 PNG. +// Icon is the icon of both the Slack app and the GitHub App: a 1024x1024 +// PNG, under the 1 MB GitHub takes, rendered from icon.svg. // -//go:embed slack/icon.png -var SlackIcon []byte +//go:embed icon.png +var Icon []byte diff --git a/assets/icon.png b/assets/icon.png new file mode 100644 index 0000000..ba93046 Binary files /dev/null and b/assets/icon.png differ diff --git a/assets/icon.svg b/assets/icon.svg new file mode 100644 index 0000000..d174be3 --- /dev/null +++ b/assets/icon.svg @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + diff --git a/assets/slack/icon.png b/assets/slack/icon.png deleted file mode 100644 index cf8c874..0000000 Binary files a/assets/slack/icon.png and /dev/null differ diff --git a/docs/github-app-setup.md b/docs/github-app-setup.md index 254cbec..f35ab8d 100644 --- a/docs/github-app-setup.md +++ b/docs/github-app-setup.md @@ -44,7 +44,11 @@ without a restart. 4. On the success page, follow the link to install the app on your organization. -5. Disable the installer: use the button on the success page, or unset +5. Add the app's icon: GitHub can't set it from the manifest, so the success + page offers it to download and links to the app's settings. There, under + **Display information**, click **Upload a logo**. + +6. Disable the installer: use the button on the success page, or unset `GITHUB_APP_INSTALLER_ENABLED`. Once an app is registered, the service refuses to exchange new installer @@ -73,6 +77,8 @@ uses, such as `GITHUB_APP_ID`, and the names this service reads, such as 3. Set the [permissions](#permissions) and [events](#events) below. 4. Click **Create GitHub App**, and note the **App ID**. +5. Under **Display information**, click **Upload a logo** and choose + [`assets/icon.png`](../assets/icon.png), the icon the Slack app uses too. [assets/github/manifest.json](../assets/github/manifest.json) holds the same settings as a manifest. diff --git a/docs/slack-setup.md b/docs/slack-setup.md index 67ee0e0..2584d99 100644 --- a/docs/slack-setup.md +++ b/docs/slack-setup.md @@ -76,6 +76,9 @@ restart, such as after the redeploy. Leave out `features.slash_commands`, the `commands` scope, and `redirect_urls` if you don't want the slash command. 3. Click **Create**. +4. Under **Basic Information**, in **Display Information**, add + [`assets/icon.png`](../assets/icon.png) as the app icon, the icon the + GitHub App uses too. To add the slash command to an app you already have, add to its manifest, under **App Manifest**, the `slash_commands` entry and the `commands` scope from diff --git a/go.mod b/go.mod index 4463956..d72a264 100644 --- a/go.mod +++ b/go.mod @@ -8,7 +8,7 @@ require ( github.com/aws/aws-sdk-go-v2/config v1.33.16 github.com/aws/aws-sdk-go-v2/service/lambda v1.114.3 github.com/aws/aws-sdk-go-v2/service/ssm v1.82.0 - github.com/cruxstack/github-app-setup-go v0.7.1 + github.com/cruxstack/github-app-setup-go v0.8.0 github.com/go-chi/chi/v5 v5.5.0 github.com/golang-jwt/jwt/v5 v5.3.1 github.com/google/go-github/v93 v93.0.0 diff --git a/go.sum b/go.sum index 6c95831..fe5ae37 100644 --- a/go.sum +++ b/go.sum @@ -39,8 +39,8 @@ github.com/cenkalti/backoff/v5 v5.0.3/go.mod h1:rkhZdG3JZukswDf7f0cwqPNk4K0sa+F9 github.com/chainguard-dev/clog v1.8.1 h1:Lab3GEDsVm1J9XGlpWEBuzXX7eETRmd0vN5PYoNyT+Y= github.com/chainguard-dev/clog v1.8.1/go.mod h1:5MQOZi+Iu7fV7GcJG8ag8rCB5elEOpqRMKEASgnGVdo= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= -github.com/cruxstack/github-app-setup-go v0.7.1 h1:LxhvlOmZzaN+zCBAK7I1kp9bUyMxjPkXD0OudWKiFIM= -github.com/cruxstack/github-app-setup-go v0.7.1/go.mod h1:zUcmElrUjvjAUQYnFj/P4spSAsaueT64tSkH+GvY58M= +github.com/cruxstack/github-app-setup-go v0.8.0 h1:BHHSKa+2hqmdtiRwgIRZ9Vc11Q14zDGa3AnmunyJ7wk= +github.com/cruxstack/github-app-setup-go v0.8.0/go.mod h1:zUcmElrUjvjAUQYnFj/P4spSAsaueT64tSkH+GvY58M= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/decred/dcrd/dcrec/secp256k1/v4 v4.4.1 h1:5RVFMOWjMyRy8cARdy79nAmgYw3hK/4HUq48LQ6Wwqo= github.com/decred/dcrd/dcrec/secp256k1/v4 v4.4.1/go.mod h1:ZXNYxsqcloTdSy/rNShjYzMhyjf0LaoftYK0p+A3h40= diff --git a/internal/service/service.go b/internal/service/service.go index dfb00f2..d347c5e 100644 --- a/internal/service/service.go +++ b/internal/service/service.go @@ -309,6 +309,7 @@ func (s *Service) newInstaller() (http.Handler, error) { GitHubURL: s.boot.Installer.GitHubURL, GitHubOrg: s.boot.Installer.GitHubOrg, OnReloadNeeded: s.runtime.ReloadCallback(), + Icon: assets.Icon, } if public := s.boot.Server.PublicURL; public != "" { cfg.RedirectURL = public @@ -348,7 +349,7 @@ func (s *Service) newSlackSetup() (http.Handler, error) { BasePath: s.boot.Server.BasePath, Store: store, API: api, - Icon: assets.SlackIcon, + Icon: assets.Icon, Logger: s.logger, OnInstalled: func(ctx context.Context) { if err := s.runtime.Reload(ctx); err != nil { diff --git a/internal/service/service_test.go b/internal/service/service_test.go index 9c16b8b..5f716ef 100644 --- a/internal/service/service_test.go +++ b/internal/service/service_test.go @@ -190,6 +190,7 @@ func TestInstaller_SetupSaveReloadAndRestart(t *testing.T) { `"vulnerability_alerts":"read"`, `"administration":"read"`, `/organizations/acme/settings/apps/new`, + `data:image/png;base64,`, } { if !strings.Contains(page, want) { t.Errorf("setup page lacks %s", want)