Merge branches
This allows you to merge branches programmatically. It requires you to call three separate APIs. This is needed if using merge queues in Github.
Merge Request
POST /api/baselines/branches/merge?SourceBranch=string&TargetBranch=string&OnlyCheck=true
Parameters
| Name | Type | In | Description |
|---|---|---|---|
| SourceBranch | string | query or body | Current Branch name -> company_name/repository/featurebranch |
| TargetBranch | string | query or body | Parent Branch Name -> company_name/repository/masterbranch |
| OnlyCheck | bool | query or body | Setting to "true" will only check for conflicts and not actually merge |
Response
This API will respond with 202 and a location.
The location in the response will be a status API URL you can check to monitor the merge operation.
cURL Example
curl -H "X-Eyes-Api-Key: <your-merge-api-key>" -X POST "https://eyes.applitools.com/api/baselines/branches/merge?SourceBranch=PRBranch&TargetBranch=main&OnlyCheck=false"
Task Status Request
GET /api/tasks/{jobId}/status
Parameters
| Name | Type | In | Description |
|---|---|---|---|
| jobId | string | body | The job id for the merge operation. |
Response
This API will respond with a 200 while the operation is happening and a 201 when the operation is complete. It will give you a URL for the results API in the location when complete.
cURL Example
curl -H "X-Eyes-Api-Key: <your-api-key>" -X GET "https://eyes.applitools.com/api/tasks/<job-id>/status"
Task Result Request
GET /api/tasks/{jobId}/result
Parameters
| Name | Type | In | Description |
|---|---|---|---|
| jobId | string | body | The job id for the merge operation. |
Response
This API will respond with a 200 when the merge operation has completed and will give details in json about the merge in the body. The body will tell you if the merge completed successfully and if there are conflicts preventing merge.
A 204 will be returned if you call the API after the Merge API was called but before the operation started. Calling the status API until you get a 201 status code will prevent this.
A 404 will be returned if the branch does not exist.
Response Example
{"merged":true,"conflicts":0,"context":"","changes":[{"source":{"id":"k~!d547403d-c739-44fb-a401-dfa25a992518~!0313092b-7166-4269-9d3f-07e86f9e98ad~!df78dd22-5af1-45f7-ae91-2d035b3f5c81~!mIWFc3nuwIhZV9VRn50SmfbJxAlgP5inQIuCy47DChc_~!","state":"a582a0de-404c-45f1-91c1-7520de012d63","rev":"00000251759088751702","updateInfo":{"by":"example.user@example.com","at":"2019-09-15T14:47:29.5129873+00:00","session":{"batchId":"00000251833741975598","id":"00000251833741974740"}},"secretToken":"","scenarioId":"df78dd22-5af1-45f7-ae91-2d035b3f5c81","scenarioName":"#29805","appId":"0313092b-7166-4269-9d3f-07e86f9e98ad","baselineModelId":"mIWFc3nuwIhZV9VRn50SmfbJxAlgP5inQIuCy47DChc_.d547403d-c739-44fb-a401-dfa25a992518","baselineEnvId":"Mac OS X 10.14$Chrome$800$600","baselineEnv":{"os":"Mac OS X 10.14","hostingApp":"Chrome","displaySize":{"width":800,"height":600}},"appName":"MyAppName","baselineBranchName":"MyNewBranch123456","isNew":false},"target":{"id":"k~!~!0313092b-7166-4269-9d3f-07e86f9e98ad~!df78dd22-5af1-45f7-ae91-2d035b3f5c81~!mIWFc3nuwIhZV9VRn50SmfbJxAlgP5inQIuCy47DChc_~!","state":"a582a0de-404c-45f1-91c1-7520de012d63","rev":"00000251759107706056","updateInfo":{"by":"example.user@example.com","at":"2019-09-15T14:47:29.5129873+00:00","session":{"batchId":"00000251833741975598","id":"00000251833741974740"}},"secretToken":"","scenarioId":"df78dd22-5af1-45f7-ae91-2d035b3f5c81","scenarioName":"#29805","appId":"0313092b-7166-4269-9d3f-07e86f9e98ad","baselineModelId":"mIWFc3nuwIhZV9VRn50SmfbJxAlgP5inQIuCy47DChc_.","baselineEnvId":"Mac OS X 10.14$Chrome$800$600","baselineEnv":{"os":"Mac OS X 10.14","hostingApp":"Chrome","displaySize":{"width":800,"height":600}},"appName":"MyAppName","baselineBranchName":"default","isNew":false},"isConflicting":false}]}
cURL Example
curl -H "X-Eyes-Api-Key: <your-api-key>" -X GET "https://eyes.applitools.com/api/tasks/<job-id>/result"