How to create and publish a Release using GitHub API v3 with curl?

三世轮回 提交于 2020-01-01 10:30:08

问题


According to the github api documentation (https://developer.github.com/v3/repos/releases/) I need to send a post request including a payload that requires the tag_name. So I proceeded to build the following curl request in order to try and publish an existing tag (0.0.5)

curl -v -i -X POST -H "Content-Type:application/json" -H "Authorization: token 1a1a1a11a11a11a11a11a11a11a1a11a1a1a1a1" https://api.github.com/repos/codeStyler87/test-tags/releases -d '{"tag_name":"0.0.5","target_commitish": "develop","name": "0.0.5","body": "Description of the release","draft": false,"prerelease": false}'

but i get HTTP/1.1 404 Not Found.

What's wrong with my request?

Am I using the API correctly?

Why GitHub API dont provide an accurate error message?


回答1:


Your access token misses the privilege public_repo.




回答2:


I had this problem and found that removing the slash in the path after releases solved it:

https://api.github.com/repos/codeStyler87/test-tags/releases

not

https://api.github.com/repos/codeStyler87/test-tags/releases/

Either that or it's completely random like the OP.



来源:https://stackoverflow.com/questions/37281884/how-to-create-and-publish-a-release-using-github-api-v3-with-curl

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!