Skip to content

Commit 5ffefdc

Browse files
authored
Deployments: use correct media-type for in_progress/queued, inactive
1 parent 95e5a79 commit 5ffefdc

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

lib/Github/Api/Deployment.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,15 @@ public function updateStatus($username, $repository, $id, array $params)
8787
if (!isset($params['state'])) {
8888
throw new MissingArgumentException(['state']);
8989
}
90+
91+
// adjust media-type per github docs
92+
// https://docs.github.com/en/rest/reference/repos#create-a-deployment-status
93+
if ($params['state'] === 'inactive') {
94+
$this->acceptHeaderValue = 'application/vnd.github.ant-man-preview+json';
95+
}
96+
if ($params['state'] === 'in_progress' || $params['state'] === 'queued') {
97+
$this->acceptHeaderValue = 'application/vnd.github.flash-preview+json';
98+
}
9099

91100
return $this->post('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/deployments/'.$id.'/statuses', $params);
92101
}

0 commit comments

Comments
 (0)