Module: Octokit::Client::ActionsArtifacts

Included in:
Octokit::Client
Defined in:
lib/octokit/client/actions_artifacts.rb

Overview

Methods for the Actions Artifacts API

Instance Method Summary collapse

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:



41
42
43
# 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:



52
53
54
55
56
57
# 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:



66
67
68
# 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:



15
16
17
18
19
# 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:



28
29
30
31
32
# 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