Skip to content

Conversation

@avelizmu
Copy link
Contributor

Add support for working with GitHub Environments.
https://docs.github.com/en/rest/deployments/environments

Allows you to set environment name, wait_timer, prevent_self_review, reviewers, deployment_branch_policy, variables, and deployment_protection_rules.

Requested in issue #291

Included unit tests for this functionality.

Also added a small change to the mergeDeep file to allow handling null value as if it were undefined, since it failed to compare deployment_branch_policy: null and deployment_branch_policy: {protected_branches: true, custom_branch_policies: false}

Format is

environments:
- name: production
  wait_timer: 0
  prevent_self_review: true
  reviewers:
  - type: User
    id: 15
  - type: Team
    id: 1337
  deployment_branch_policy: #null also acceptable instead of values
    protected_branches: true
    custom_branch_policies: false
    # or
    protected_branches: false
    custom_branch_policies:
    - master
    - dev
  variables:
  - name: endpoint
    value: https://1.1.1.1
  - name: id
    value: "1984" # Important, only takes strings
  deployment_protection_rules:
  - appId: 12345

@decyjphr decyjphr merged commit e584dbc into github:main-enterprise Oct 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants