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

Environment creation doesn't set custom branch policies

Open
#876 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

Currently the environment configuration doesn't properly create environments with custom branch policies. It creates the environment and sets it to use "Custom branch policies" but it doesn't create the rules for the selected branches/tags.

### What is actually happening

We are using the following configuration to set our environment but it's not applying the branch policies:

```
environments:
- name: prod
prevent_self_review: true
deployment_branch_policy:
protected_branches: false
custom_branch_policies:
- names: ["main"]
type: "branch"
```

Image

We also tried the legacy format, org level and suborg level; no success.

We know the environment creation and configuration it's a two step operation from the API side (one call to create the environment and a second one to create the branch protection policy). It looks like it's only doing the first one.

### What is the expected behavior

I would expect to have the environment created and the defined custom branch policy set.

### Safe-settings version
Commit SHA: 861d70f1d24427f523363a83709429d7aa041510

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.