While trying to set the build status of a commit through ssh, I was experiencing some difficulties. I first set the build status successfully, using a
Next, I retrieved the GitHub commit status, using:
GET https://api.github.com/repos/$USER/$REPO/commits/$COMMIT_SHA/statuses
Which outputs:
[{"url":"https://api.github.com/repos/... ,"state":"failure","description":"Failed!","target_url":"https://www.stackoverflow.com","context":"default","created_at":"2021-12-19T10:10:20Z","updated_at":"2021-12-19T10:10:20Z"...,"site_admin":false}}]
Which is as expected.
Then for the second part, I tried to omit using a GitHub personal access token, and use my ssh credentials to set the commit build status. However, this answer seems to suggest that that is currently not possible. Hence, I would like to ask:
How can I set a GitHub commit build status using ssh credentials in Bash?
CodePudding user response:
I stand by my 2013 answer and confirm, in late 2021, that using SSH for GitHub API URL seems not supported.
Even the latest GitHub CLI gh api
command only proposes HTTPS calls, not SSH.
Makes an authenticated HTTP request to the GitHub API and prints the response.
The endpoint argument should either be a path of a GitHub API v3 endpoint, or "graphql" to access the GitHub API v4.