From ca5363f31148fe2a9bf3ec9f041ba7e94f426de6 Mon Sep 17 00:00:00 2001 From: "Kandasamy, Divya" Date: Mon, 28 Oct 2024 22:50:18 -0400 Subject: [PATCH] Update check-pr.yml --- .github/workflows/check-pr.yml | 70 ++++++++++++++++++++++------------ 1 file changed, 46 insertions(+), 24 deletions(-) diff --git a/.github/workflows/check-pr.yml b/.github/workflows/check-pr.yml index 7386f5a0..c2545b58 100644 --- a/.github/workflows/check-pr.yml +++ b/.github/workflows/check-pr.yml @@ -37,43 +37,65 @@ jobs: repository: rdkcentral/firebolt-apis event-type: trigger-workflow client-payload: '{"OPENRPC_PR_BRANCH": "${{ github.event.pull_request.head.ref }}"}' + - name: Get JS Workflow Run ID run: | TOKEN="${{ secrets.WORKFLOW_TRIGGER_SECRET }}" REPO_OWNER="rdkcentral" REPO_NAME="firebolt-apis" WORKFLOW_NAME="MFOS standalone sanity report - CORE,MANAGE,DISCOVERY" + MAX_RETRIES=20 + SLEEP_TIME=15 # seconds + + for ((i=0; i> $GITHUB_ENV + break + else + echo "Waiting for JavaScript workflow to start..." + sleep $SLEEP_TIME + fi + done - # Get workflow ID - js_workflow_id=$(curl -s -H "Authorization: token $TOKEN" \ - "https://api.github.com/repos/$REPO_OWNER/$REPO_NAME/actions/workflows" | jq \ - --arg WORKFLOW_NAME "$WORKFLOW_NAME" '.workflows[] | select(.name == $WORKFLOW_NAME).id') - - # Capture the specific run ID for the workflow just triggered - js_run_id=$(curl -s -H "Authorization: token $TOKEN" \ - "https://api.github.com/repos/$REPO_OWNER/$REPO_NAME/actions/workflows/$js_workflow_id/runs?per_page=1" | \ - jq -r '.workflow_runs[0].id') - - echo "JS_RUN_ID=$js_run_id" >> $GITHUB_ENV - + # Poll until the C++ SDK workflow run is available - name: Get CPP Workflow Run ID run: | TOKEN="${{ secrets.WORKFLOW_TRIGGER_SECRET }}" REPO_OWNER="rdkcentral" REPO_NAME="firebolt-apis" WORKFLOW_NAME="CXX build" - - # Fetch workflow ID - cpp_workflow_id=$(curl -s -H "Authorization: token $TOKEN" \ - "https://api.github.com/repos/$REPO_OWNER/$REPO_NAME/actions/workflows" | jq \ - --arg WORKFLOW_NAME "$WORKFLOW_NAME" '.workflows[] | select(.name == $WORKFLOW_NAME).id') - - # Fetch the specific run ID for the workflow triggered by this workflow - cpp_run_id=$(curl -s -H "Authorization: token $TOKEN" \ - "https://api.github.com/repos/$REPO_OWNER/$REPO_NAME/actions/workflows/$cpp_workflow_id/runs?per_page=1" | \ - jq -r '.workflow_runs[0].id') - - echo "CPP_RUN_ID=$cpp_run_id" >> $GITHUB_ENV + MAX_RETRIES=20 + SLEEP_TIME=15 # seconds + + for ((i=0; i> $GITHUB_ENV + break + else + echo "Waiting for C++ workflow to start..." + sleep $SLEEP_TIME + fi + done - name: Debugging JS Workflow ID and Run ID