Skip to content

Instantly share code, notes, and snippets.

@AesSedai101
Created October 9, 2019 14:54
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 AesSedai101/88652c40640cd64cc77551cdcee7adf0 to your computer and use it in GitHub Desktop.
Save AesSedai101/88652c40640cd64cc77551cdcee7adf0 to your computer and use it in GitHub Desktop.
Bitrise build results to csv
accessToken="<Bitrise token>"
file="bitrise_results.csv"
response=$(curl "https://api.bitrise.io/v0.1/builds?limit=50" -H "accept: application/json" -H "Authorization: $accessToken")
echo "Clearing out $file"
# These need to match the fields specified in the jq .data | map
echo "Triggered, Finished, Status, Slug, Workflow, Triggered by, Repo" > $file
for count in {1..20} # Will grab details on the most recent 20*50=1000 build results
do
echo "Loop: $count"
echo "$response" | jq '.data | map("\(.triggered_at), \(.finished_at), \(.status_text), \(.slug), \(.triggered_workflow), \(.triggered_by), \(.repository.title)") | .[]' | sed s/\"//g >> $file
next=$(echo "$response" | jq '.paging.next' | sed s/\"//g )
echo "Curling $next"
response=$(curl "https://api.bitrise.io/v0.1/builds?limit=50&next=$next" -H "accept: application/json" -H "Authorization: $accessToken")
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment