You know these moments when things should go right, but they don't? We do. Couple of weeks ago we had a moment of terror waiting at our doorstep. Just the day when the deploy for one of our clients was supposed to happen it turned out that GitHub was having issues 😱.
Even though the issues were affecting several parts of GitHub, we managed to make pull requests in order to have the code needed to deploy but the web-hooks that would call the deploy where not working and the client was expecting the release as it was already agreed upon.

The solution
Looking into Semaphore's documentation we saw that if you have the project hash_id
, the branch_id
, the commit_sha
and the auth_token
you can launch the build.
Where are they located?
Project hash id
The project hash_id can be found in the project page by going into Project Settings > Admin.

Authentication Token
You can find the auth_token inside Settings > Account Settings.

Branch id
In order to know the branch_id we need to call the endpoint in the command shown bellow, using curl for example:
curl -X GET 'https://semaphoreci.com/api/v1/projects/<project_hash_id>/branches?auth_token=<auth_token>'
Response
[
{
"id":123456789,
"name":"development",
"branch_url":"https://semaphoreci.com/api/v1/projects/<project_hash_id>/123456789/status?auth_token=<auth_token>"
},
{
"id":987654321,
"name":"master",
"branch_url":"https://semaphoreci.com/api/v1/projects/<project_hash_id>/987654321/status?auth_token=<auth_token>"
}
]
The branch_id is the id
property of the response object.
Commit sha
The commit_sha can be found in Github when seeing the commit.

Deploying
After gathering all the needed information you can run the following command, using curl, to start deploying:
curl -X POST 'https://semaphoreci.com/api/v1/projects/<project_hash_id>/<branch_id>/build?commit_sha=<commit_sha>&auth_token=<auth_token>'
Note:
More information on how to do this, can be found here: https://semaphoreci.com/docs/branches-and-builds-api.html