diff --git a/.github/workflows/build-and-test-multiplatform.yml b/.github/workflows/build-and-test-multiplatform.yml index b4af49d4f3..1ebf7b53f5 100644 --- a/.github/workflows/build-and-test-multiplatform.yml +++ b/.github/workflows/build-and-test-multiplatform.yml @@ -23,16 +23,14 @@ jobs: - name: Get latest workflow run ID from target branch id: get_run_id run: | - set workflow_name=Build and Test OCCT on Multiple Platforms - set target_branch=${{ github.event.pull_request.base.ref }} - echo Fetching latest run ID for workflow: "%workflow_name%" on branch: "%target_branch%" - curl -s -H "Accept: application/vnd.github.v3+json" "https://api.github.com/repos/${{ github.repository }}/actions/runs?branch=%target_branch%&status=success&event=pull_request" > response.json - for /F "tokens=*" %%i in ('jq -r ".workflow_runs[] | select(.name==\"%workflow_name%\") | .id" response.json ^| head -n 1') do ( - set latest_run_id=%%i - ) - echo Latest run ID: %latest_run_id% - echo latest_run_id=%latest_run_id% >> %GITHUB_ENV% - shell: cmd + $workflow_name = "Build and Test OCCT on Multiple Platforms" + $target_branch = "${{ github.event.pull_request.base.ref }}" + Write-Host "Fetching latest run ID for workflow: $workflow_name on branch: $target_branch" + $response = Invoke-RestMethod -Uri "https://api.github.com/repos/${{ github.repository }}/actions/runs?branch=$target_branch&status=success&event=pull_request" -Headers @{Accept = "application/vnd.github.v3+json"} + $latest_run_id = ($response.workflow_runs | Where-Object { $_.name -eq $workflow_name } | Select-Object -First 1).id + Write-Host "Latest run ID: $latest_run_id" + echo "latest_run_id=$latest_run_id" >> $GITHUB_ENV + shell: pwsh - name: Download test results from target branch uses: actions/download-artifact@v4.1.7