From 3b54a58d140d7deb1c5583537daa35d30f4ca765 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Sibiril?= <81782+aureliensibiril@users.noreply.github.com> Date: Thu, 28 May 2026 22:22:46 +0200 Subject: [PATCH] Offer Personal account in Heroku org picker MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Heroku Teams are opt-in, so a solo account surfaces no options and the picker used to dead-end at a free-text slug the user cannot fill. Always append a synthetic Personal account entry so the picker offers personal mode instead. Signed-off-by: Aurélien Sibiril <81782+aureliensibiril@users.noreply.github.com> --- pkg/accessreview/drivers/organizations.go | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/pkg/accessreview/drivers/organizations.go b/pkg/accessreview/drivers/organizations.go index 583ceddb9..ea7a30c35 100644 --- a/pkg/accessreview/drivers/organizations.go +++ b/pkg/accessreview/drivers/organizations.go @@ -245,7 +245,11 @@ func ListBitbucketOrganizations(ctx context.Context, httpClient *http.Client) ([ } // ListHerokuOrganizations fetches the teams the authenticated Heroku -// user belongs to. +// user belongs to, and always appends a synthetic "Personal account" +// entry. Heroku Teams are an opt-in paid construct, so a solo account has +// no team to discover; the personal entry lets the picker offer personal +// mode (app owner + collaborators) instead of dead-ending at a free-text +// slug the user cannot fill. func ListHerokuOrganizations(ctx context.Context, httpClient *http.Client) ([]Organization, error) { req, err := http.NewRequestWithContext(ctx, http.MethodGet, "https://api.heroku.com/teams", nil) if err != nil { @@ -273,16 +277,21 @@ func ListHerokuOrganizations(ctx context.Context, httpClient *http.Client) ([]Or return nil, fmt.Errorf("cannot decode heroku organizations response: %w", err) } - result := make([]Organization, len(teams)) - for i, t := range teams { + result := make([]Organization, 0, len(teams)+1) + for _, t := range teams { displayName := t.Name if displayName == "" { displayName = t.ID } - result[i] = Organization{Slug: t.ID, DisplayName: displayName} + result = append(result, Organization{Slug: t.ID, DisplayName: displayName}) } + result = append(result, Organization{ + Slug: herokuPersonalAccountSlug, + DisplayName: herokuPersonalAccountDisplayName, + }) + return result, nil }