123456789_123456789_123456789_123456789_123456789_

Module: Octokit::Client::Environments

Relationships & Source Files
Extension / Inclusion / Inheritance Descendants
Included In:
Defined in: lib/octokit/client/environments.rb

Overview

Methods for the Environments API

Instance Method Summary

Instance Method Details

#create_or_update_environment(repo, environment_name, options = {}) ⇒ Sawyer::Resource

Create or update an environment with protection rules, such as required reviewers

Parameters:

  • repo (Integer, String, Repository, Hash)

    A GitHub repository

  • environment_name (String)

    The name of the environment

  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):

  • :wait_timer (Integer)

    The amount of time to delay a job after the job is initially triggered. The time (in minutes) must be an integer between 0 and 43,200 (30 days).

  • :reviewers (Array)

    The people or teams that may review jobs that reference the environment. You can list up to six users or teams as reviewers.

  • :deployment_branch_policy (Object)

    The type of deployment branch policy for this environment. To allow all branches to deploy, set to null.

Returns:

  • (Sawyer::Resource)

    An environment

See Also:

[ GitHub ]

  
# File 'lib/octokit/client/environments.rb', line 43

def create_or_update_environment(repo, environment_name, options = {})
  put("#{Repository.path repo}/environments/#{environment_name}", options)
end

#delete_environment(repo, environment_name, options = {}) ⇒ No Content

Delete an Environment

Parameters:

  • repo (Integer, String, Repository, Hash)

    A GitHub repository

  • environment_name (String)

    The name of the environment

See Also:

[ GitHub ]

  
# File 'lib/octokit/client/environments.rb', line 53

def delete_environment(repo, environment_name, options = {})
  delete("#{Repository.path repo}/environments/#{environment_name}", options)
end

#environment(repo, environment_name, options = {}) ⇒ Sawyer::Resource

Fetch a single environment for a repository

Parameters:

  • repo (Integer, String, Repository, Hash)

    A GitHub repository

  • environment_name (String)

    The name of the environment

Returns:

  • (Sawyer::Resource)

    A single environment

See Also:

[ GitHub ]

  
# File 'lib/octokit/client/environments.rb', line 15

def environment(repo, environment_name, options = {})
  get("#{Repository.path repo}/environments/#{environment_name}", options)
end

#environments(repo, options = {}) ⇒ Sawyer::Resource Also known as: #list_environments

Lists the environments for a repository

Parameters:

  • repo (Integer, String, Repository, Hash)

    A GitHub repository

  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):

  • :per_page (Integer)

    The number of results per page (max 100). Default: 30

  • :page (Integer)

    Page number of the results to fetch. Default: 1

Returns:

  • (Sawyer::Resource)

    Total count of environments and list of environments

See Also:

[ GitHub ]

  
# File 'lib/octokit/client/environments.rb', line 26

def environments(repo, options = {})
  paginate("#{Repository.path repo}/environments", options) do |data, last_response|
    data.environments.concat last_response.data.environments
    data.total_count += last_response.data.total_count
  end
end

#list_environments(repo, options = {})

Alias for #environments.

[ GitHub ]

  
# File 'lib/octokit/client/environments.rb', line 32

alias list_environments environments