github / github/ruleset-recipes
Recreating the example from README throws the error: "Error importing ruleset: The ruleset you are importing contains an invalid actor"
- Dominant language
- No language data
- Stars
- 495
- Forks
- 143
- PR merge metrics
- No merged PRs in 30d
Description
## Describe the bug
Importing the `branch-rulesets/PRs and commits.json` rulesets throws an error.
## To Reproduce
1. Clone this repo.
2. Open a repo with admin rights.
3. Go to Settings -> Rules -> Rulesets.
4. Import the ruleset `branch-rulesets/PRs and commits.json` as shown in the video example from this repo.
## Expected behavior
The ruleset gets imported as shown in the video without throwing any errors.
## Actual behavior
The following error is thrown:
```
Error importing ruleset: The ruleset you are importing contains an invalid actor
```
## Screenshots/Video
https://github.com/user-attachments/assets/b900ce93-ea42-407d-940d-47d01042e6ed
## Environment
- OS: macOS
- Browser: Chrome
## Additional Context
Possible source of the error:
- My Github account is a [personal account](https://docs.github.com/en/get-started/learning-about-github/types-of-github-accounts#personal-accounts).
- According to the [Github Docs](https://docs.github.com/en/rest/orgs/rules?versionId=free-pro-team%40latest&page=enums&apiVersion=2022-11-28#create-an-organization-repository-ruleset--parameters) (see "Properties of `bypass_actors` -> `actor_id`"), the `"actor_type": "OrganizationAdmin"` used in the [`PRs and commits.json#L44`](https://github.com/github/ruleset-recipes/blob/82adf8954a5cafb9722c18c421b9834c24ec0cd0/branch-rulesets/PRs%20and%20commits.json#L44) file is not applicable for personal repositories.
- FWIW I was able to import the rule _after_ deleting the `bypass_actors` property from the [`PRs and commits.json` file](https://github.com/github/ruleset-recipes/blob/82adf8954a5cafb9722c18c421b9834c24ec0cd0/branch-rulesets/PRs%20and%20commits.json).
- Manually adding the bypass actors and exporting the ruleset revealed the following `bypass_actors` block where the actor IDs 2, 4, 5 correspond to `maintain`, `write`, and `admin` respectively as discussed [here](https://github.com/github/rest-api-description/issues/4406#issuecomment-2580627194).
```json
"bypass_actors": [
{
"actor_id": 2,
"actor_type": "RepositoryRole",
"bypass_mode": "always"
},
{
"actor_id": 4,
"actor_type": "RepositoryRole",
"bypass_mode": "always"
},
{
"actor_id": 5,
"actor_type": "RepositoryRole",
"bypass_mode": "always"
}
]
```
Contributor guide
Assessment
This issue has not been assessed yet.