# encoding: utf-8moduleGithub# The Releases APIclassRepos::Releases<APIGithub::require_all'github_api/repos/releases','assets'VALID_RELEASE_PARAM_NAMES=%w[
tag_name
target_commitish
name
body
draft
prerelease
].freeze# :nodoc:# Access to Repos::Releases::Assets APIdefassets(options={},&block)@assets||=ApiFactory.new('Repos::Releases::Assets',current_options.merge(options),&block)end# List releases for a repository## Users with push access to the repository will receive all releases# (i.e., published releases and draft releases). Users with pull access# will receive published releases only.## = Examples# github = Github.new# github.repos.releases.list 'owner', 'repo'# github.repos.releases.list 'owner', 'repo' { |release| ... }#deflist(*args)params=arguments(args,required: [:owner,:repo]).paramsresponse=get_request("/repos/#{owner}/#{repo}/releases",params)returnresponseunlessblock_given?response.each{|el|yieldel}endalias:all:list# Get a single release## = Examples# github = Github.new# github.repos.releases.get 'owner', 'repo', 'id'#defget(*args)params=arguments(args,required: [:owner,:repo,:id]).paramsget_request("/repos/#{owner}/#{repo}/releases/#{id}",params)endalias:find:get# Create a release## = Inputs# * <tt>:tag_name</tt> - Required string# * <tt>:target_commitish</tt> - Optional string - Specifies the commitish# value that determines where the Git tag is created from. Can be# any branch or commit SHA. Defaults to the repository's default# branch (usually 'master'). Unused if the Git tag already exists.# * <tt>:name</tt> - Optional string# * <tt>:body</tt> - Optional string# * <tt>:draft</tt> - Optional boolean - <tt>true</tt> to create a draft# (unpublished) release, <tt>false</tt> to create# a published one. Default is false.# * <tt>:prerelease</tt> - Optional boolean - <tt>true</tt> to identify# the release as a prerelease. false to identify# the release as a full release. Default is false.## = Examples# github = Github.new# github.repos.releases.create 'owner', 'repo', 'tag-name',# "tag_name": "v1.0.0",# "target_commitish": "master",# "name": "v1.0.0",# "body": "Description of the release",# "draft": false,# "prerelease": false#defcreate(*args)arguments(args,required: [:owner,:repo,:tag_name])dosiftVALID_RELEASE_PARAM_NAMESendparams=arguments.paramsparams['tag_name']=tag_namepost_request("/repos/#{owner}/#{repo}/releases",params)end# Edit a release## = Inputs# * <tt>:tag_name</tt> - Required string# * <tt>:target_commitish</tt> - Optional string - Specifies the commitish# value that determines where the Git tag is created from. Can be# any branch or commit SHA. Defaults to the repository's default# branch (usually 'master'). Unused if the Git tag already exists.# * <tt>:name</tt> - Optional string# * <tt>:body</tt> - Optional string# * <tt>:draft</tt> - Optional boolean - <tt>true</tt> to create a draft# (unpublished) release, <tt>false</tt> to create# a published one. Default is false.# * <tt>:prerelease</tt> - Optional boolean - <tt>true</tt> to identify# the release as a prerelease. false to identify# the release as a full release. Default is false.## = Examples# github = Github.new# github.repos.releases.edit 'owner', 'repo', 'id',# "tag_name": "v1.0.0",# "target_commitish": "master",# "name": "v1.0.0",# "body": "Description of the release",# "draft": false,# "prerelease": false#defedit(*args)arguments(args,required: [:owner,:repo,:id])dosiftVALID_RELEASE_PARAM_NAMESendparams=arguments.paramspatch_request("/repos/#{owner}/#{repo}/releases/#{id}",params)endalias:update:edit# Delete a release## Users with push access to the repository can delete a release.## = Examples# github = Github.new# github.repos.releases.delete 'owner', 'repo', 'id'#defdelete(*args)params=arguments(args,required: [:owner,:repo,:id]).paramsdelete_request("/repos/#{owner}/#{repo}/releases/#{id}",params)endend# Repos::Statusesend# Github