From c6e13c4a1abf820870d6b7f9060a000d444983be Mon Sep 17 00:00:00 2001 From: alexanderM91 Date: Tue, 3 Dec 2024 07:44:32 +0100 Subject: [PATCH] Update the output --- .github/workflows/ci.yml | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0ec012db..fe9c304b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -76,22 +76,19 @@ jobs: # Fetch job details for the current run JOBS_JSON=$(curl -s -H "Authorization: Bearer $GITHUB_TOKEN" \ "https://api.github.com/repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/jobs") - - # Debug the full response + + # Save API response for debugging echo "$JOBS_JSON" > jobs-response.json cat jobs-response.json - - # Safely extract the job ID using jq - JOB_ID=$(echo "$JOBS_JSON" | jq -r --arg JOB_NAME "fetch-job-id" '.jobs[]? | select(.name == $JOB_NAME) | .id') - - # Handle cases where the job ID is not found - if [ -z "$JOB_ID" ]; then - echo "Error: Could not find job ID for job named 'fetch-job-id'." - exit 1 - fi - + + # Extract the first job ID (replace logic if selecting a specific job by name) + JOB_ID=$(echo "$JOBS_JSON" | jq -r '.jobs[0].id') + + # Debug output + echo "Extracted Job ID: $JOB_ID" + + # Save to environment for future steps echo "JOB_ID=$JOB_ID" >> $GITHUB_ENV - echo "Job ID: $JOB_ID" - name: Get the previous commit hash id: previous_commit