Skip to content

Cannot add teams to repo.yml #809

Open
@bheemvennapureddy

Description

@bheemvennapureddy

Problem Description

What's Happening

We're managing repository-level team permissions using individual repo YAML files (e.g., Mobile.yml, Web.yml, infra.yml) under the .github/repos directory. We do not maintain any team configurations in settings.yml.

The intent is to explicitly grant certain teams (like all engineering teams) permissions to deploy to non-prod environments. For example:

# .github/repos/Prequal.yml

repository:
  name: Prequal
  teams:
    - name: SRE
      permission: maintain
    - name: "Engineering Members"
      permission: push

However, when applying these settings, we encounter the following error:

Error adding team: 422

API response:

{
  "message": "Validation Failed",
  "errors": [
    {
      "resource": "Team",
      "code": "unprocessable",
      "field": "data",
      "message": "Name must be unique for this org"
    }
  ],
  "documentation_url": "https://docs.github.com/rest/teams/teams#create-a-team",
  "status": "422"
}

This seems to happen when the team already exists or is already associated with the repository.

Expected Behavior

We want to know if there's a way to skip adding a team if it already exists or is already associated with the repository, to avoid the 422 error. Ideally, the settings app should be idempotent in this case.


Context

  • GitHub App: Self-hosted instance of probot/settings
  • Platform: GitHub Enterprise (EMU)
  • Versions:
    • probot/settings: [please insert version]
    • GitHub Enterprise: [please insert version]

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions