Module: Octokit::Client::ActionsWorkflows

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

Overview

Methods for the Actions Workflows API

Instance Method Summary collapse

Instance Method Details

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

Get single workflow in a repository

Parameters:

  • repo (Integer, String, Repository, Hash)

    A GitHub repository

  • id (Integer, String)

    Id or file name of the workflow

Returns:

  • (Sawyer::Resource)

    A single workflow

See Also:



29
30
31
# File 'lib/octokit/client/actions_workflows.rb', line 29

def workflow(repo, id, options = {})
  get "#{Repository.path repo}/actions/workflows/#{id}", options
end

#workflow_disable(repo, id, options = {}) ⇒ Boolean

Disable a workflow

Parameters:

  • repo (Integer, String, Repository, Hash)

    A GitHub repository

  • id (Integer, String)

    Id or file name of the workflow

Returns:

  • (Boolean)

    True if workflow was disabled, false otherwise

See Also:



63
64
65
# File 'lib/octokit/client/actions_workflows.rb', line 63

def workflow_disable(repo, id, options = {})
  boolean_from_response :put, "#{Repository.path repo}/actions/workflows/#{id}/disable", options
end

#workflow_dispatch(repo, id, ref, options = {}) ⇒ Boolean

Create a workflow dispatch event

Parameters:

  • repo (Integer, String, Repository, Hash)

    A GitHub repository

  • id (Integer, String)

    Id or file name of the workflow

  • ref (String)

    A SHA, branch name, or tag name

Returns:

  • (Boolean)

    True if event was dispatched, false otherwise

See Also:



41
42
43
# File 'lib/octokit/client/actions_workflows.rb', line 41

def workflow_dispatch(repo, id, ref, options = {})
  boolean_from_response :post, "#{Repository.path repo}/actions/workflows/#{id}/dispatches", options.merge({ ref: ref })
end

#workflow_enable(repo, id, options = {}) ⇒ Boolean

Enable a workflow

Parameters:

  • repo (Integer, String, Repository, Hash)

    A GitHub repository

  • id (Integer, String)

    Id or file name of the workflow

Returns:

  • (Boolean)

    True if workflow was enabled, false otherwise

See Also:



52
53
54
# File 'lib/octokit/client/actions_workflows.rb', line 52

def workflow_enable(repo, id, options = {})
  boolean_from_response :put, "#{Repository.path repo}/actions/workflows/#{id}/enable", options
end

#workflows(repo, options = {}) ⇒ Sawyer::Resource Also known as: list_workflows

Get the workflows in a repository

Parameters:

  • repo (Integer, String, Repository, Hash)

    A GitHub repository

Returns:

  • (Sawyer::Resource)

    the total count and an array of workflows

See Also:



15
16
17
18
19
# File 'lib/octokit/client/actions_workflows.rb', line 15

def workflows(repo, options = {})
  paginate "#{Repository.path repo}/actions/workflows", options do |data, last_response|
    data.workflows.concat last_response.data.workflows
  end
end