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

Invalid rules: 'Workflows' error when using the example yaml for organization ruleset

Open
#659 2 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
We're using the safe-setting to implement a ruleset at organisation level. The ruleset is created and works fine until we try to add a workflow rule. In such case, using a configuration that's pretty much identical to the one provided as example (https://github.com/github/safe-settings/blob/main-enterprise/docs/sample-settings/settings.yml#L343-L355) we receive an _Invalid rules: 'Workflows'_ from the safe-setting execution

### What is actually happening
This is the configuration part that trigger the issue:

```
rules:
# # Choose which workflows must pass before branches can be merged.
- type: workflows
parameters:
workflows:
- path: .github/workflows/myworkflow.yml
repository_id: 111111111 #actual id redacted
ref: refs/heads/main
```

if the workflow type part is commented out the rules are applied correctly.

### What is the expected behavior
The expected behavior is for the ruleset to be updated with the additional rule

### Error output, if available
safe settings execution returns the following error

HttpError: Validation Failed: "Invalid rules: 'Workflows'"

The error seems to imply git hub api doesn't like the "workflow" object. However, the REST API docs seems to confirm the structure is correct as for https://docs.github.com/en/rest/orgs/rules?apiVersion=2022-11-28#create-an-organization-repository-rulesetfor

## Context

### Are you using the hosted instance of probot/settings or running your own?
We're running our own instance

### If running your own instance, are you using it with github.com or GitHub Enterprise?
We are using GitHub enterprise but Cloud hosted on github.com

#### Version of probot/settings
safe settings 2.1.10

#### Version of GitHub Enterprise
the live one, we use cloud GHE

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.