diff --git a/runatlantis.io/docs/server-configuration.md b/runatlantis.io/docs/server-configuration.md index 185ce2f6bc..9081f74719 100644 --- a/runatlantis.io/docs/server-configuration.md +++ b/runatlantis.io/docs/server-configuration.md @@ -450,7 +450,13 @@ Values are chosen in this order: # or ATLANTIS_GH_TEAM_ALLOWLIST="myteam:plan, secteam:apply, DevOps Team:apply" ``` - Comma-separated list of GitHub team name (not a slug) and permission pairs. By default, any team can plan and apply. + In versions v0.21.0 and later, the GitHub team name can be a name or a slug. + + In versions v0.20.1 and below, the Github team name required the case sensitive team name. + + Comma-separated list of GitHub teams and permission pairs. + + By default, any team can plan and apply. ::: warning NOTE You should use the Team name as the variable, not the slug, even if it has spaces or special characters. diff --git a/server/events/vcs/github_client.go b/server/events/vcs/github_client.go index cc24ac922b..1517dc9239 100644 --- a/server/events/vcs/github_client.go +++ b/server/events/vcs/github_client.go @@ -534,6 +534,7 @@ func (g *GithubClient) GetTeamNamesForUser(repo models.Repo, user models.User) ( Edges []struct { Node struct { Name string + Slug string } } PageInfo struct { @@ -551,7 +552,7 @@ func (g *GithubClient) GetTeamNamesForUser(repo models.Repo, user models.User) ( return nil, err } for _, edge := range q.Organization.Teams.Edges { - teamNames = append(teamNames, edge.Node.Name) + teamNames = append(teamNames, edge.Node.Name, edge.Node.Slug) } if !q.Organization.Teams.PageInfo.HasNextPage { break diff --git a/server/events/vcs/github_client_test.go b/server/events/vcs/github_client_test.go index 77e50dd85e..9d938ca42c 100644 --- a/server/events/vcs/github_client_test.go +++ b/server/events/vcs/github_client_test.go @@ -1134,8 +1134,8 @@ func TestGithubClient_GetTeamNamesForUser(t *testing.T) { "organization": { "teams":{ "edges":[ - {"node":{"name":"frontend-developers"}}, - {"node":{"name":"employees"}} + {"node":{"name": "Frontend Developers", "slug":"frontend-developers"}}, + {"node":{"name": "Employees", "slug":"employees"}} ], "pageInfo":{ "endCursor":"Y3Vyc29yOnYyOpHOAFMoLQ==", @@ -1168,5 +1168,5 @@ func TestGithubClient_GetTeamNamesForUser(t *testing.T) { Username: "testuser", }) Ok(t, err) - Equals(t, []string{"frontend-developers", "employees"}, teams) + Equals(t, []string{"Frontend Developers", "frontend-developers", "Employees", "employees"}, teams) }