Method: Gitlab::Client::Commits#update_commit_status

Defined in:
lib/gitlab/client/commits.rb

#update_commit_status(project, sha, state, options = {}) ⇒ Object Also known as: repo_update_commit_status

Adds or updates a status of a commit.

Examples:

Gitlab.update_commit_status(42, '6104942438c14ec7bd21c6cd5bd995272b3faff6', 'success')
Gitlab.update_commit_status(42, '6104942438c14ec7bd21c6cd5bd995272b3faff6', 'failed', { name: 'jenkins' })
Gitlab.update_commit_status(42, '6104942438c14ec7bd21c6cd5bd995272b3faff6', 'canceled', { name: 'jenkins', target_url: 'http://example.com/builds/1' })

Parameters:

  • project (Integer, String)

    The ID or name of a project.

  • sha (String)

    The commit hash

  • state (String)

    of the status. Can be: pending, running, success, failed, canceled

  • options (Hash) (defaults to: {})

    A customizable set of options.

Options Hash (options):

  • :ref (String)

    The ref (branch or tag) to which the status refers

  • :name (String)

    Filter by status name, eg. jenkins

  • :target_url (String)

    The target URL to associate with this status



168
169
170
# File 'lib/gitlab/client/commits.rb', line 168

def update_commit_status(project, sha, state, options = {})
  post("/projects/#{url_encode project}/statuses/#{sha}", body: options.merge(state: state))
end