Skip to content

Instantly share code, notes, and snippets.

@iurisilvio
Created April 16, 2018 20:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iurisilvio/0184179a7a2beba2789b70f5caae230d to your computer and use it in GitHub Desktop.
Save iurisilvio/0184179a7a2beba2789b70f5caae230d to your computer and use it in GitHub Desktop.
CircleCI download artifacts
- run:
name: Download Coverage Artifacts
command: |
LAST_SUCCESSFUL_BUILD=`curl -u $CIRCLE_TOKEN: "https://circleci.com/api/v1.1/project/github/$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME?filter=successful&limit=1" | grep '"build_url"' | grep -oE '[0-9]+'`
curl -u $CIRCLE_TOKEN: "https://circleci.com/api/v1.1/project/github/$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME/$LAST_SUCCESSFUL_BUILD/artifacts" | grep -o 'https://[^"]*.json' | xargs -P4 -I % wget --force-directories --cut-dirs=1 --no-host-directories %?circle-token=$CIRCLE_TOKEN
for file in `find . -name '*\?*'`; do mv "$file" "${file%%\?*}"; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment