123456789_123456789_123456789_123456789_123456789_

Module: Octokit::Client::ActionsArtifacts

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

Overview

Methods for the Actions Artifacts API

Instance Method Summary

Instance Method Details

#artifact(repo, id, options = {}) ⇒ Sawyer::Resource

Get an artifact

Parameters:

  • repo (Integer, String, Repository, Hash)

    A GitHub repository

  • id (Integer)

    Id of an artifact

Returns:

  • (Sawyer::Resource)

    Artifact information

See Also:

[ GitHub ]

  
# 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 = {}) ⇒ String

Get a download URL for an artifact

Parameters:

  • repo (Integer, String, Repository, Hash)

    A GitHub repository

  • id (Integer)

    Id of an artifact

Returns:

  • (String)

    URL to the .zip archive of the artifact

See Also:

[ GitHub ]

  
# 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 = {}) ⇒ Boolean

Delete an artifact

Parameters:

  • repo (Integer, String, Repository, Hash)

    A GitHub repository

  • id (Integer)

    Id of an artifact

Returns:

  • (Boolean)

    Return true if the artifact was successfully deleted

See Also:

[ GitHub ]

  
# 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 = {}) ⇒ Sawyer::Resource

List all artifacts for a repository

Parameters:

  • repo (Integer, String, Repository, Hash)

    A GitHub repository

Returns:

  • (Sawyer::Resource)

    the total count and an array of artifacts

See Also:

[ GitHub ]

  
# 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 = {}) ⇒ Sawyer::Resource

List all artifacts for a workflow run

Parameters:

  • repo (Integer, String, Repository, Hash)

    A GitHub repository

  • workflow_run_id (Integer)

    Id of a workflow run

Returns:

  • (Sawyer::Resource)

    the total count and an array of artifacts

See Also:

[ GitHub ]

  
# 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