将状态发送到Github

时间:2018-10-16 14:37:15

标签: bash github

我正尝试向PR发送新状态,请按照以下步骤操作:

1.-我通过以下命令调用了API,以获得STATUSES_URL:

curl -X GET -u *MY_TOKEN_ID*:x-oauth-basic 'https://api.github.com/repos/*MY_ORGANIZATION*/*MY_REPO*/pulls/18'

2.-在Json文件结果中,我找到了STATUSES_URL字段,其中包含我需要使用的URL,例如:

"statuses_url": "https://api.github.com/repos/*MY_ORGANIZATION*/*MY_REPO*/statuses/*MY_COMMIT_ID*",

3.-然后,我使用STATUSES_URL向API发起了这样的请求:

curl -H "Content-Type: application/json; charset=UTF-8" -d @statuses.json -u *MY_TOKEN_ID*:x-oauth-basic https://api.github.com/repos/*MY_ORGANIZATION*/*MY_REPO*/statuses/*MY_COMMIT_ID*

json文件的内容:

{ 
   "state": "success", 
   "target_url": "https://*MY.CI.SERVER*/job/*XXXXX*/job/*REPO*/view/change-requests/job/PR-18/1/console",
   "description": "Jenkins-CI",
   "context": "continuous-integration/jenkins"
}

但是始终可以获得相同的结果:未找到

{
  "message": "Not Found",
  "documentation_url": "https://developer.github.com/v3/repos/statuses/#create-a-status"
}

我阅读了有关状态程序的所有文档,但我不能理解这是我失败的原因。

有没有建议?

0 个答案:

没有答案