August 2018
Intermediate to advanced
416 pages
12h 37m
English
We can certainly use the CircleCI web app and click the workflows section and find our most recent build, but let's use the CircleCI API instead and use jq to parse the JSON response payload as we have done before for other API endpoints.
Here is a command that will pipe output from the /recent-builds API endpoint to jq and return the first build_url from the array of objects, which will be the most recent build, and then pipe that into the system clipboard. We can see the shape of the JSON in the recent build project in the https://circleci.com/docs/api/v1-reference/#recent-builds-project documentation:
curl -X GET \ --header "Accept: application/json" \ "https://circleci.com/api/v1.1/project/github/packtci/circleci-jobs-example?circle-token=$CIRCLECI_API_TOKEN_GITHUB" ...
Read now
Unlock full access