module Octokit::Client::ActionsArtifacts

Methods for the Actions Artifacts API

@see developer.github.com/v3/actions/artifacts

Public Instance Methods

artifact(repo, id, options = {}) click to toggle source

Get an artifact

@param repo [Integer, String, Repository, Hash] A GitHub repository @param id [Integer] Id of an artifact

@return [Sawyer::Resource] Artifact information @see docs.github.com/en/rest/actions/artifacts#get-an-artifact

# File lib/octokit/client/actions_artifacts.rb, line 41
def artifact(repo, id, options = {})
  get "#{Repository.path repo}/actions/artifacts/#{id}", options
end
artifact_download_url(repo, id, options = {}) click to toggle source

Get a download URL for an artifact

@param repo [Integer, String, Repository, Hash] A GitHub repository @param id [Integer] Id of an artifact

@return [String] URL to the .zip archive of the artifact @see docs.github.com/en/rest/actions/artifacts#download-an-artifact

# File lib/octokit/client/actions_artifacts.rb, line 52
def artifact_download_url(repo, id, options = {})
  url = "#{Repository.path repo}/actions/artifacts/#{id}/zip"

  response = client_without_redirects.head(url, options)
  response.headers['Location']
end
delete_artifact(repo, id, options = {}) click to toggle source

Delete an artifact

@param repo [Integer, String, Repository, Hash] A GitHub repository @param id [Integer] Id of an artifact

@return [Boolean] Return true if the artifact was successfully deleted @see docs.github.com/en/rest/actions/artifacts#delete-an-artifact

# File lib/octokit/client/actions_artifacts.rb, line 66
def delete_artifact(repo, id, options = {})
  boolean_from_response :delete, "#{Repository.path repo}/actions/artifacts/#{id}", options
end
repository_artifacts(repo, options = {}) click to toggle source

List all artifacts for a repository

@param repo [Integer, String, Repository, Hash] A GitHub repository

@return [Sawyer::Resource] the total count and an array of artifacts @see developer.github.com/v3/actions/artifacts#list-artifacts-for-a-repository

# File lib/octokit/client/actions_artifacts.rb, line 15
def repository_artifacts(repo, options = {})
  paginate "#{Repository.path repo}/actions/artifacts", options do |data, last_response|
    data.artifacts.concat last_response.data.artifacts
  end
end
workflow_run_artifacts(repo, workflow_run_id, options = {}) click to toggle source

List all artifacts for a workflow run

@param repo [Integer, String, Repository, Hash] A GitHub repository @param workflow_run_id [Integer] Id of a workflow run

@return [Sawyer::Resource] the total count and an array of artifacts @see docs.github.com/en/rest/actions/artifacts#list-workflow-run-artifacts

# File lib/octokit/client/actions_artifacts.rb, line 28
def workflow_run_artifacts(repo, workflow_run_id, options = {})
  paginate "#{Repository.path repo}/actions/runs/#{workflow_run_id}/artifacts", options do |data, last_response|
    data.artifacts.concat last_response.data.artifacts
  end
end