github-community-projects / github-community-projects/safe-settings

Repositories exclusion not working for empty repos

Open
#1,014 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
JavaScript
Stars
921
Forks
226
Avg merge
18h 3m
Merged PRs (30d)
14

Description

## Problem Description
I have this `deployment-settings.yml`:
```
restrictedRepos:
exclude:
- repo-A
- repo-B
- myrepo
```
Settings are NOT enforced on `myrepo` as expected, but such enforcement is triggered on both `repo-A` and `repo-B`. Such enforcement fails cause `repo-A` and `repo-B` are still empty and an error is thrown.

### What is actually happening
The settings enforcement is triggered even if repository is listed among the excluded ones.

### What is the expected behavior
That the excluded repositories are actually excluded by any kind of attempt of settings enforcement.

### Error output, if available

Error applying branch protection.

```json
{
"name":"HttpError",
"status":404,
"data": {
"message":"Branch not found",
"documentation_url":"https://docs.github.com/rest/branches/branch-protection#update-branch-protection",
"status":"404"
}
}
```

Such error is totally fair cause the repos are effectively empty. But why does it matter since the repo should be excluded? It seems such exclusion is ignored.

## Context

### Are you using the hosted instance of probot/settings or running your own?
My own, deployed via Github action as per [documentation](https://github.com/github/safe-settings/blob/main-enterprise/docs/github-action.md#running-safe-settings-with-github-actions-gha)

### If running your own instance, are you using it with github.com or GitHub Enterprise?
github.com

#### Version of probot/settings
probot/13.4.4

#### Version of GitHub Enterprise
-

Contributor guide

Open the contributing guide

Research direction

Start with the deployment-settings.yml exclusion configuration and trace the GitHub Action's settings-enforcement entry point through the branch-protection request. Reproduce the issue with an excluded empty repository, then verify that excluded repositories are skipped before any enforcement call and that non-excluded repositories still enforce settings.

Written by the indexing model from the issue text.

Assessment

Tech stack
github-actions, javascript
Domain
devops
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.