Skip to content

Commit a3fd346

Browse files
authored
bug #981 backported #979 into 2.x (staabm)
This PR was merged into the 2.x branch. Discussion ---------- Deployments: use proper media-type for in_progress/queued, inactive state as discussed in #979 (comment) Commits ------- 0c2815f bug #979 Deployments: use proper media-type for in_progress/queued, inactive state (staabm)
2 parents 90e695e + 0c2815f commit a3fd346

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

lib/Github/Api/Deployment.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
*/
1212
class Deployment extends AbstractApi
1313
{
14+
use AcceptHeaderTrait;
15+
1416
/**
1517
* List deployments for a particular repository.
1618
*
@@ -88,6 +90,15 @@ public function updateStatus($username, $repository, $id, array $params)
8890
throw new MissingArgumentException(['state']);
8991
}
9092

93+
// adjust media-type per github docs
94+
// https://docs.github.com/en/rest/reference/repos#create-a-deployment-status
95+
if ($params['state'] === 'inactive') {
96+
$this->acceptHeaderValue = 'application/vnd.github.ant-man-preview+json';
97+
}
98+
if ($params['state'] === 'in_progress' || $params['state'] === 'queued') {
99+
$this->acceptHeaderValue = 'application/vnd.github.flash-preview+json';
100+
}
101+
91102
return $this->post('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/deployments/'.$id.'/statuses', $params);
92103
}
93104

0 commit comments

Comments
 (0)