Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 4 additions & 3 deletions assets/assets.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Binary file added assets/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 19 additions & 0 deletions assets/icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed assets/slack/icon.png
Binary file not shown.
8 changes: 7 additions & 1 deletion docs/github-app-setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down
3 changes: 3 additions & 0 deletions docs/slack-setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down
3 changes: 2 additions & 1 deletion internal/service/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 {
Expand Down
1 change: 1 addition & 0 deletions internal/service/service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down