class Github::Client::Repos::Deployments
Constants
- VALID_DEPLOYMENTS_OPTIONS
- VALID_STATUS_OPTIONS
Public Instance Methods
create(*args)
click to toggle source
Create a deployment
@param [Hash] params @option params [String] :ref
Required string. The ref to deploy. This can be a branch, tag, or sha.
@option params [Boolean] :auto_merge
Optional boolean. Merge the default branch into the requested.
@option params [Array] :required_contexts
Optional array of status contexts verified against commit status checks. If this parameter is omitted from the parameters then all unique contexts will be verified before a deployment is created. To bypass checking entirely pass an empty array. Defaults to all unique contexts.
@option params [String] :payload
Optional JSON payload with extra information about the deployment. Default: ""
@option params [String] :payload
Optional String. Name for the target deployment environment (e.g., production, staging, qa). Default: "production"
@option params [String] :description
Optional string. Optional short description.
@example
github = Github.new github.repos.deployments.create 'user-name', 'repo-name', ref: '...' github.repos.deployments.create 'user-name', 'repo-name', ref: '...', description: 'New deploy', force: true
@api public
# File lib/github_api/client/repos/deployments.rb, line 76 def create(*args) arguments(args, required: [:user, :repo]) do permit VALID_DEPLOYMENTS_OPTIONS assert_required %w[ ref ] end params = arguments.params params['accept'] ||= PREVIEW_MEDIA post_request("repos/#{arguments.user}/#{arguments.repo}/deployments", arguments.params) end
create_status(*args)
click to toggle source
Create a deployment status
@param [Hash] params @option params [String] :id
Required string. Id of the deployment being referenced.
@option params [String] :state
Required string. State of the deployment. Can be one of: pending, success, error, or failure.
@option params [String] :target_url
Optional string. The URL associated with the status.
@option params [String] :description
Optional string. A short description of the status.
@example
github = Github.new github.repos.deployments.create_status 'user-name', 'repo-name', DEPLOYMENT_ID, state: '...'
@api public
# File lib/github_api/client/repos/deployments.rb, line 127 def create_status(*args) arguments(args, required: [:user, :repo, :id]) do assert_required %w[ state ] permit VALID_STATUS_OPTIONS end params = arguments.params params['accept'] ||= PREVIEW_MEDIA post_request("repos/#{arguments.user}/#{arguments.repo}/deployments/#{arguments.id}/statuses", params) end
list(*args) { |el| ... }
click to toggle source
List deployments on a repository
@example
github = Github.new github.repos.deployments.list 'user-name', 'repo-name' github.repos.deployments.list 'user-name', 'repo-name' { |deployment| ... }
@api public
# File lib/github_api/client/repos/deployments.rb, line 33 def list(*args) arguments(args, required: [:user, :repo]) params = arguments.params params['accept'] ||= PREVIEW_MEDIA response = get_request("repos/#{arguments.user}/#{arguments.repo}/deployments", params) return response unless block_given? response.each { |el| yield el } end
Also aliased as: all
statuses(*args) { |status| ... }
click to toggle source
List the statuses of a deployment.
@param [Hash] params @option params [String] :id
Required string. Id of the deployment being queried.
@example
github = Github.new github.repos.deployments.statuses 'user-name', 'repo-name', DEPLOYMENT_ID github.repos.deployments.statuses 'user-name', 'repo-name', DEPLOYMENT_ID { |status| ... }
@api public
# File lib/github_api/client/repos/deployments.rb, line 99 def statuses(*args) arguments(args, required: [:user, :repo, :id]) params = arguments.params params['accept'] ||= PREVIEW_MEDIA statuses = get_request("repos/#{arguments.user}/#{arguments.repo}/deployments/#{arguments.id}/statuses", params) return statuses unless block_given? statuses.each { |status| yield status } end