fix: only allow team slug support in --gh-team-allowlist by dropping support for ambiguous team names (#5510)

Signed-off-by: Ricard Bejarano <ricard@bejarano.io>
Co-authored-by: PePe Amengual <2208324+jamengual@users.noreply.github.com>
Co-authored-by: Rui Chen <rui@chenrui.dev>
Co-authored-by: RB <7775707+nitrocode@users.noreply.github.com>
This commit is contained in:
Ricard Bejarano
2025-04-13 00:39:21 +02:00
committed by GitHub
parent a992ab4724
commit 6c129199d6
3 changed files with 7 additions and 10 deletions

View File

@@ -686,12 +686,14 @@ based on the organization or user that triggered the webhook.
### `--gh-team-allowlist`
```bash
atlantis server --gh-team-allowlist="myteam:plan, secteam:apply, DevOps Team:apply, DevOps Team:import"
atlantis server --gh-team-allowlist="myteam:plan, secteam:apply, devops-team:apply, devops-team:import"
# or
ATLANTIS_GH_TEAM_ALLOWLIST="myteam:plan, secteam:apply, DevOps Team:apply, DevOps Team:import"
ATLANTIS_GH_TEAM_ALLOWLIST="myteam:plan, secteam:apply, devops-team:apply, devops-team:import"
```
In versions v0.21.0 and later, the GitHub team name can be a name or a slug.
In versions v0.35.0 and later, the GitHub team name can only be a slug because it is immutable.
In versions between v0.21.0 and v0.34.0, 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.
@@ -699,11 +701,6 @@ based on the organization or user that triggered the webhook.
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.
i.e., "Engineering Team:plan, Infrastructure Team:apply"
:::
### `--gh-token`
```bash

View File

@@ -1052,7 +1052,7 @@ func (g *GithubClient) GetTeamNamesForUser(logger logging.SimpleLogging, repo mo
return nil, err
}
for _, edge := range q.Organization.Teams.Edges {
teamNames = append(teamNames, edge.Node.Name, edge.Node.Slug)
teamNames = append(teamNames, edge.Node.Slug)
}
if !q.Organization.Teams.PageInfo.HasNextPage {
break

View File

@@ -1406,7 +1406,7 @@ func TestGithubClient_GetTeamNamesForUser(t *testing.T) {
Username: "testuser",
})
Ok(t, err)
Equals(t, []string{"Frontend Developers", "frontend-developers", "Employees", "employees"}, teams)
Equals(t, []string{"frontend-developers", "employees"}, teams)
}
func TestGithubClient_DiscardReviews(t *testing.T) {