Skip to content

Commit 4747587

Browse files
committed
Add job URL
1 parent 7cd681a commit 4747587

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

.github/workflows/check-new-library-versions-in-batch.yml

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ jobs:
5858
needs: get-all-libraries
5959
permissions: write-all
6060
env:
61+
CURRENT_JOB_NAME: "🧪 ${{ matrix.item.name }}"
6162
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6263
ISSUE_TITLE_PREFIX: "[Automation] Testing failed for library: "
6364
ISSUE_BODY_PREFIX: "Failure kind: "
@@ -126,7 +127,7 @@ jobs:
126127
id: runtests
127128
run: |
128129
bash ./.github/workflows/run-consecutive-tests.sh "${{ env.TEST_COORDINATES }}" '${{ toJson(matrix.item.versions) }}' 2>&1 | tee test_results.txt || true
129-
130+
130131
# Extract successful versions
131132
grep "^PASSED:" test_results.txt | sed 's/PASSED://g' > successful_versions.txt
132133
echo "successful_versions<<EOF" >> $GITHUB_OUTPUT
@@ -135,9 +136,19 @@ jobs:
135136
136137
# Extract failure type and failed version
137138
awk -F'[][]|:' '/^FAILED/ {print "failure_type="$2; print "failed_version="$4}' test_results.txt >> $GITHUB_OUTPUT
138-
139-
# Extract runner log URL
140-
echo "runner_log_url=https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" >> $GITHUB_OUTPUT
139+
140+
# Fetch the job URL
141+
JOB_ID=$(
142+
gh run view "${{ github.run_id }}" --repo "${{ github.repository }}" --json jobs \
143+
| jq -r --arg name "$CURRENT_JOB_NAME" '.jobs[] | select(.name | startswith($name)) | .databaseId' \
144+
| head -n1
145+
)
146+
if [ -z "$JOB_ID" ] || [ "$JOB_ID" = "null" ]; then
147+
# Fallback to run-level URL if job lookup fails
148+
echo "runner_log_url=https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" >> $GITHUB_OUTPUT
149+
else
150+
echo "runner_log_url=https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}/job/$JOB_ID" >> $GITHUB_OUTPUT
151+
fi
141152
142153
# Extract log tail
143154
echo "log_tail<<EOF" >> $GITHUB_OUTPUT

0 commit comments

Comments
 (0)