github-community-projects / github-community-projects/safe-settings
settings.yml triggers unwanted rename via PATCH – "name already exists on this account" error
- Dominant language
- JavaScript
- Stars
- 921
- Forks
- 226
- Avg merge
- 18h 3m
- Merged PRs (30d)
- 14
Description
## Problem Description
We are using the `github/safe-settings` app to manage organization-level repo configurations via `settings.yml`. However, it unexpectedly attempts to rename a repository during a `PATCH` request—even though we do **not** specify a `name` field in our config.
### What is actually happening
The app issues a PATCH request to update a repository and includes the `"name"` field in the request body:
```json
"name": "RepoX"
This results in a 422 Validation Failed error:
"errors":[
{
"resource":"Repository",
"code":"custom",
"field":"name",
"message":"name already exists on this account"
}
]
This happens even though name: is not configured in our settings.yml.
### What is the expected behavior
The app should not include the name field in the PATCH payload unless it is explicitly defined in the settings.yml. No rename attempts should happen unless intentional.
### Error output, if available
DEBUG (RepoX): GitHub request: PATCH https://api.github.com/repos/org-name/repo-name - 422
private: true
visibility: "private"
has_issues: true
has_wiki: true
default_branch: "trunk"
allow_squash_merge: true
allow_merge_commit: false
allow_rebase_merge: false
delete_branch_on_merge: true
security_and_analysis: {
"advanced_security": {
"status": "enabled"
},
"secret_scanning": {
"status": "enabled"
},
"secret_scanning_push_protection": {
"status": "enabled"
}
}
security: {
"enableVulnerabilityAlerts": true
}
org: "org-name"
ERROR (probot): Error {"name":"HttpError","status":422,"response":{"url":"https://api.github.com/repos/org-name/repo-name","status":422,"data":{"message":"Validation Failed","errors":[{"resource":"Repository","code":"custom","field":"name","message":"name already exists on this account"}]}},"request":{"method":"PATCH","url":"https://api.github.com/repos/org-name/repo-name","headers":{"authorization":"token [REDACTED]"},"body":"{\"private\":true, ... ,\"name\":\"RepoX\",\"org\":\"org-name\"}"}}
```
```
## Context
### Are you using the hosted instance of probot/settings or running your own?
Running via GitHub Actions using the github/safe-settings repo.
### If running your own instance, are you using it with github.com or GitHub Enterprise?
Using with github Enterprise
#### Version of probot/settings
2.1.16 (referenced in GitHub Actions workflow)
#### Version of GitHub Enterprise
Contributor guide
Assessment
This issue has not been assessed yet.