Edit build pipeline
Open the build pipeline and set it to ignore all branches by using the pattern *.
Find the ID of the pipeline
Check the URL of the pipeline and extract the ID from the final part of the path e.g. for https://app.wercker.com/Tapadoo/oathello-docs/workflows/pipelines/58ffb44990d16a010030f8b8 the ID is 58ffb44990d16a010030f8b8.
Create an API Token
Personal tokens to use the API can be created from the profile settings:
https://app.wercker.com/profile/tokens
Kick off a build for the master branch
Using the API we can kick off a build specifically for the master branch.
$ curl -H "Content-Type: application/json" -H 'Authorization: Bearer <TOKEN>' \
-X POST -d '{"pipelineId":"58ffb44990d16a010030f8b8","branch":"master"}' \
https://app.wercker.com/api/v3/runs/
{
"id": "58ffb648f71af600010cbeb9",
"url": "https://app.wercker.com/api/v3/runs/58ffb648f71af600010cbeb9",
"branch": "master",
"commitHash": "8bbaf758469dfaa29cefb6fa5ec5b43548a5ca23",
"createdAt": "2017-04-25 20:49:12.464559979 +0000 UTC",
"message": "Kicking off build with ignore all.\n",
"result": "unknown",
"status": "notstarted",
"user": {
"type": "wercker",
"name": "jkeyes",
"userId": "519d571ad7b90ec870000cf1",
"meta": {
"username": "jkeyes"
},
"avatar": {
"gravatar": "d454691311a159667588fe7079c81542"
}
},
"pipeline": {
"id": "58ffb44990d16a010030f8b8",
"url": "https://app.wercker.com/api/v3/pipelines/58ffb44990d16a010030f8b8",
"createdAt": "2017-04-25 20:40:41.306 +0000 UTC",
"name": "build-it",
"permissions": "read",
"pipelineName": "build",
"setScmProviderStatus": true,
"type": "git"
}
}
Any branch can be used
To change the branch to be built, the branch property in the JSON payload can be set to the branch name. Here’s an example for a non-existant branch called blah:
curl -H "Content-Type: application/json" -H 'Authorization: Bearer <TOKEN>' \
-X POST -d '{"pipelineId":"58ffb44990d16a010030f8b8","branch":"blah"}' \
https://app.wercker.com/api/v3/runs/
{
"Error": "branch does not exist",
"Code": 5
}