Find all workflows for repository

tl;dr: How do I get all the workflows for all the branches in a repository?

I’m trying to do some analysis on workflows for a particular repository. I’ve found I can list out the workflows that run on the default branch with:

curl -XGET "${PROJECT_SLUG}/workflows?circle-token=${CIRCLECI_TOKEN}"

But that doesn’t cover all the branches, and some workflows only run on certain branches. I don’t want to have to know all the branches and workflows for a project to list all the workflows that have run. I tried listing all the pipelines that have run with:

curl -XGET "${PROJECT_SLUG}/pipeline?circle-token=${CIRCLECI_TOKEN}&branch=staging"

But can’t correlate them with a workflow like the documentation implies I should be able to:

$ BASE="${PROJECT_SLUG}/pipeline" \
> && PIPELINE_ID="$(curl -XGET "${BASE}?circle-token=${CIRCLECI_TOKEN}" | jq -r '.items | first(.[]) | .id')" \
> && curl -XGET "${BASE}/${PIPELINE_ID}/workflow?circle-token=${CIRCLECI_TOKEN}"
  "message" : "Not Found"

Is the documentation at incorrect?

1 Like

I’m going to put a face into a desk. The project slug is not necessary to get the workflows out of a pipeline. The documentation is correct, though very confusing.${PROJECT_SLUG}/pipeline is for listing pipelines.${PIPELINE_ID}/workflow lists workflows for a pipeline

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.