@@ -46,14 +46,55 @@ jobs:
4646 fi
4747
4848 - name : Download Test Artifacts
49- uses : actions/download-artifact@v4
50- with :
51- name : test-results-pr-${{ steps.workflow-info.outputs.pr-number }}
52- path : reports/
53- github-token : ${{ secrets.GITHUB_TOKEN }}
54- run-id : ${{ github.event.workflow_run.id }}
55- continue-on-error : true
5649 if : steps.workflow-info.outputs.is-pr == 'true'
50+ uses : nick-fields/retry@v3
51+ with :
52+ timeout_minutes : 5
53+ max_attempts : 3
54+ retry_on : error
55+ command : |
56+ echo "Attempting to download artifacts from workflow run: ${{ github.event.workflow_run.id }}"
57+ echo "Looking for artifact: test-results-pr-${{ steps.workflow-info.outputs.pr-number }}"
58+
59+ # Create reports directory
60+ mkdir -p reports/
61+
62+ # Use curl to download the artifact (as a fallback method)
63+ # First, get the artifact download URL
64+ ARTIFACT_URL=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
65+ "https://api.github.com/repos/${{ github.repository }}/actions/runs/${{ github.event.workflow_run.id }}/artifacts" | \
66+ jq -r '.artifacts[] | select(.name == "test-results-pr-${{ steps.workflow-info.outputs.pr-number }}") | .archive_download_url')
67+
68+ if [ "$ARTIFACT_URL" = "null" ] || [ -z "$ARTIFACT_URL" ]; then
69+ echo "❌ Could not find artifact URL"
70+ echo "Available artifacts:"
71+ curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
72+ "https://api.github.com/repos/${{ github.repository }}/actions/runs/${{ github.event.workflow_run.id }}/artifacts" | \
73+ jq -r '.artifacts[] | .name'
74+ exit 1
75+ fi
76+
77+ echo "Downloading from: $ARTIFACT_URL"
78+ curl -L -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
79+ "$ARTIFACT_URL" -o reports/artifact.zip
80+
81+ if [ ! -f "reports/artifact.zip" ]; then
82+ echo "❌ Failed to download artifact"
83+ exit 1
84+ fi
85+
86+ # Extract the artifact
87+ unzip -o reports/artifact.zip -d reports/
88+ rm reports/artifact.zip
89+
90+ # Verify the file exists
91+ if [ -f "reports/combined-results.xml" ]; then
92+ echo "✅ combined-results.xml found"
93+ else
94+ echo "❌ combined-results.xml not found"
95+ ls -la reports/ 2>/dev/null || echo "reports/ directory is empty"
96+ exit 1
97+ fi
5798
5899 - name : Validate Test Results
59100 id : validate-results
@@ -144,7 +185,13 @@ jobs:
144185 - Test results not being generated
145186 - Artifact upload issues
146187 - Workflow failure before test completion
188+ - Timing issues with artifact availability
189+
190+ Please check the original workflow run for more details: ${{ github.event.workflow_run.html_url }}
147191
148- Please check the original workflow run for more details: ${{ github.event.workflow_run.html_url }}`
192+ **Artifact Details:**
193+ - Expected artifact name: \`test-results-pr-${prNumber}\`
194+ - Workflow run ID: ${{ github.event.workflow_run.id }}
195+ - Workflow run URL: ${{ github.event.workflow_run.html_url }}`
149196 });
150197 }
0 commit comments