Skip to content

Instantly share code, notes, and snippets.

@pwfcurry
Created June 3, 2021 11:34
Show Gist options
  • Save pwfcurry/29574490e5737026bb74cf216907077e to your computer and use it in GitHub Desktop.
Save pwfcurry/29574490e5737026bb74cf216907077e to your computer and use it in GitHub Desktop.
List all semaphore workflows for a project
#!/bin/bash
# Replace <API_TOKEN> with your token from https://me.semaphoreci.com/account
# Replace <PROJECT_ID> with the project ID (can get this by describing a job: https://docs.semaphoreci.com/reference/api-v1alpha/#describe-job)
# Run the following to get the page count (in the `link` header, rel=last) & replace 69 below with the value:
#
# curl -sIXGET -H "Authorization: Token <API_TOKEN>" \
# "https://countingup.semaphoreci.com/api/v1alpha/plumber-workflows?project_id=<PROJECT_ID>"
#
# See https://docs.semaphoreci.com/reference/api-v1alpha/#pagination
for i in {1..69}
do
file=sem_workflows_page_$i.json
echo $file
curl -s -H "Authorization: Token <API_TOKEN>" \
"https://countingup.semaphoreci.com/api/v1alpha/plumber-workflows?page=$i&project_id=<PROJECT_ID>" > $file &
done
wait
echo "done"
@pwfcurry
Copy link
Author

pwfcurry commented Jun 3, 2021

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment