I am kicking off a workflow from another repo and am trying to wait for it to finish, once created I am trying to use the id to find the workflow details but am getting a response saying the job id is wrong.
please see script and output below:
RESPONSE=$(curl --request POST --url https://circleci.com/api/v2/project/github/pizzahutuk/dv-commerce/pipeline --header "Circle-Token: $CIRCLE_TOKEN" --header "content-type: application/json" --data '{"parameters": {"run_codegen": true, "deploy": false}}')
echo $RESPONSE
JOB_ID=$(echo $RESPONSE | jq '.number')
PIPELINE_ID=$(echo $RESPONSE | jq '.id')
URL=https://app.circleci.com/pipelines/github/pizzahutuk/dv-commerce/${JOB_ID}
echo
echo dv-commerce contract check created at:
echo $URL
sleep 5m
JOB=$(curl --request GET --url https://circleci.com/api/v2/project/github/pizzahutuk/dv-commerce/job/${JOB_ID} --header "Circle-Token: $CIRCLE_TOKEN" --header "content-type: application/json")
echo $JOB
WORKFLOW=$(curl --request GET --url https://circleci.com/api/v2/pipeline/${PIPELINE_ID}/workflow --header "Circle-Token: $CIRCLE_TOKEN" --header "content-type: application/json")
echo $WORKFLOW
RESPONSE=$(curl --request GET --url https://circleci.com/api/v2/workflow/${PIPELINE_ID} --header "Circle-Token: $CIRCLE_TOKEN" --header "content-type: application/json")
echo $RESPONSE
output:
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 199 100 145 100 54 243 90 --:--:-- --:--:-- --:--:-- 333
{ "number" : 80299, "state" : "setup-pending", "id" : "68fbe0be-a202-41e2-b4d6-22c0582aebea", "created_at" : "2025-04-10T02:23:18.918Z" }
dv-commerce contract check created at:
https://app.circleci.com/pipelines/github/pizzahutuk/dv-commerce/80299
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 34 100 34 0 0 123 0 --:--:-- --:--:-- --:--:-- 123
{ "message": "Job not found" }
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 39 100 39 0 0 242 0 --:--:-- --:--:-- --:--:-- 243
{ "message" : "Invalid pipeline-id" }
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 38 100 38 0 0 250 0 --:--:-- --:--:-- --:--:-- 251
{ "message" : "Workflow not found" }