Skip to content

Latest commit

 

History

History
56 lines (36 loc) · 1.81 KB

deployments.md

File metadata and controls

56 lines (36 loc) · 1.81 KB

Repo / Deployments API

Back to the "Repos API" | Back to the navigation

Provides information about deployments for a repository. Wraps GitHub Deployments API.

List all deployments.

$deployments = $client->api('deployment')->all('KnpLabs', 'php-github-api');

You can also filter the returned results (see the documentation for more information):

$deployments = $client->api('deployment')->all('KnpLabs', 'php-github-api', array('environment' => 'production'));

List one deployment.

$deployment = $client->api('deployment')->show('KnpLabs', 'php-github-api', $id);

Create a new deployment.

The ref parameter is required.

$data = $client->api('deployment')->create('KnpLabs', 'php-github-api', array('ref' => 'fd6a5f9e5a430dddae8d6a8ea378f913d3a766f9'));

Please note that once a deployment is created it cannot be edited. Only status updates can be created.

Delete a existing deployment.

$deployment = $client->api('deployment')->show('KnpLabs', 'php-github-api', $id);

Please note that a deployment can only be deleted when in inactive state. Consider transitioning the status to inactive beforehand using updateStatus.

Create a new status update.

The state parameter is required. At the time of writing, this must be pending, queued, in_progress, success, inactive, error, or failure.

$data = $client->api('deployment')->updateStatus('KnpLabs', 'php-github-api', 1, array('state' => 'error', 'description' => 'syntax error'));

Get all status updates for a deployment.

$statusUpdates = $client->api('deployment')->getStatuses('KnpLabs', 'php-github-api', 1);