123456789_123456789_123456789_123456789_123456789_

Module: Octokit::Client::Deployments

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

Overview

Methods for the Deployments API

Instance Method Summary

Instance Method Details

#create_deployment(repo, ref, options = {}) ⇒ Sawyer::Resource

Create a deployment for a ref

Parameters:

  • repo (Integer, String, Repository, Hash)

    A GitHub repository

  • ref (String)

    The ref to deploy

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

    a customizable set of options

Options Hash (options):

  • :task (String)

    Used by the deployment system to allow different execution paths. Defaults to "deploy".

  • :payload (String)

    Meta info about the deployment

  • :auto_merge (Boolean)

    Optional parameter to merge the default branch into the requested deployment branch if necessary. Default: true

  • :required_contexts (Array<String>)

    Optional array of status contexts verified against commit status checks.

  • :environment (String)

    Optional name for the target deployment environment (e.g., production, staging, qa). Default: "production"

  • :description (String)

    Optional short description.

Returns:

  • (Sawyer::Resource)

    A deployment

See Also:

[ GitHub ]

  
# File 'lib/octokit/client/deployments.rb', line 41

def create_deployment(repo, ref, options = {})
  options[:ref] = ref
  post("#{Repository.path repo}/deployments", options)
end

#create_deployment_status(deployment_url, state, options = {}) ⇒ Sawyer::Resource

Create a deployment status for a Deployment

Parameters:

  • deployment_url (String)

    A URL for a deployment resource

  • state (String)

    The state: pending, success, failure, error

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

    a customizable set of options

Options Hash (options):

  • :target_url (String)

    The target URL to associate with this status. Default: ""

  • :description (String)

    A short description of the status. Maximum length of 140 characters. Default: ""

Returns:

  • (Sawyer::Resource)

    A deployment status

See Also:

[ GitHub ]

  
# File 'lib/octokit/client/deployments.rb', line 75

def create_deployment_status(deployment_url, state, options = {})
  deployment = get(deployment_url, accept: options[:accept])
  options[:state] = state.to_s.downcase
  post(deployment.rels[:statuses].href, options)
end

#delete_deployment(repo, deployment_id, options = {}) ⇒ No Content

Delete a Deployment

Parameters:

  • repo (Integer, String, Repository, Hash)

    A GitHub repository

  • deployment_id (Integer, String, Repository, Hash)

    A GitHub repository

See Also:

[ GitHub ]

  
# File 'lib/octokit/client/deployments.rb', line 52

def delete_deployment(repo, deployment_id, options = {})
  delete("#{Repository.path repo}/deployments/#{deployment_id}", options)
end

#deployment(repo, deployment_id, options = {}) ⇒ Sawyer::Resource

Fetch a single deployment for a repository

Parameters:

  • repo (Integer, String, Repository, Hash)

    A GitHub repository

  • deployment_id (Integer, String, Repository, Hash)

    A GitHub repository

Returns:

  • (Sawyer::Resource)

    A single deployment

See Also:

[ GitHub ]

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

def deployment(repo, deployment_id, options = {})
  get("#{Repository.path repo}/deployments/#{deployment_id}", options)
end

#deployment_statuses(deployment_url, options = {}) ⇒ Array<Sawyer::Resource> Also known as: #list_deployment_statuses

List all statuses for a Deployment

Parameters:

  • deployment_url (String)

    A URL for a deployment resource

Returns:

  • (Array<Sawyer::Resource>)

    A list of deployment statuses

See Also:

[ GitHub ]

  
# File 'lib/octokit/client/deployments.rb', line 61

def deployment_statuses(deployment_url, options = {})
  deployment = get(deployment_url, accept: options[:accept])
  get(deployment.rels[:statuses].href, options)
end

#deployments(repo, options = {}) ⇒ Array<Sawyer::Resource> Also known as: #list_deployments

List all deployments for a repository

Parameters:

  • repo (Integer, String, Repository, Hash)

    A GitHub repository

Returns:

  • (Array<Sawyer::Resource>)

    A list of deployments

See Also:

[ GitHub ]

  
# File 'lib/octokit/client/deployments.rb', line 24

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

#list_deployment_statuses(deployment_url, options = {})

[ GitHub ]

  
# File 'lib/octokit/client/deployments.rb', line 65

alias list_deployment_statuses deployment_statuses

#list_deployments(repo, options = {})

Alias for #deployments.

[ GitHub ]

  
# File 'lib/octokit/client/deployments.rb', line 27

alias list_deployments deployments