github-community-projects / github-community-projects/safe-settings
Cannot add teams to repo.yml
- Lingua principale
- JavaScript
- Stelle
- 922
- Fork
- 227
- Merge medio
- 18h 3m
- PR unite (30g)
- 14
Descrizione
## 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:
```yaml
# .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:
```json
{
"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]
---
Guida per i contributori
Apri la guida per i contributori
Direzione di ricerca
Inizia con l’esempio `.github/repos/Prequal.yml` e riproduci l’applicazione di un team esistente o di un team già associato al repository nell’app `probot/settings` self-hosted. Segui il punto di ingresso per l’aggiunta di un team e verifica che l’applicazione della configurazione venga completata senza l’errore 422 di GitHub Enterprise.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- github, javascript
- Ambito
- api, backend
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 35/100