1111 runs-on : ubuntu-latest
1212 if : ${{ github.event.workflow_run.conclusion == 'success' }}
1313 steps :
14+ - name : Set up GitHub CLI
15+ uses : actions/setup-gh@v2
16+ with :
17+ version : latest
18+
19+ - name : Auth GitHub CLI
20+ run : gh auth login --with-token <<< "${{ secrets.GITHUB_TOKEN }}"
21+
1422 - name : Get Artifact and Pull request info
1523 env :
1624 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
2432 SUITE_ID=$(jq -r '.check_suite_id' <<< "$WORKFLOW_RUN_EVENT_OBJ")
2533 echo "SUITE_ID=$SUITE_ID" >> "$GITHUB_ENV"
2634
27- ARTIFACT_ID=$(gh api "/repos/$OWNER/$REPO/actions/artifacts" \
28- --jq ".artifacts[] | select(.workflow_run.id==$PREVIOUS_JOB_ID and .expired==false and .name=='detailedEvolutionPlot.png') | .id" | head -n1)
35+ # Retry loop to wait for artifact availability
36+ for i in {1..5}; do
37+ ARTIFACT_ID=$(gh api "/repos/$OWNER/$REPO/actions/artifacts" \
38+ --jq ".artifacts[] | select(.workflow_run.id==$PREVIOUS_JOB_ID and .expired==false and .name==\"detailedEvolutionPlot.png\") | .id" | head -n1)
39+ if [[ -n "$ARTIFACT_ID" ]]; then break; fi
40+ echo "Artifact not found yet. Retrying in 10s..."
41+ sleep 10
42+ done
2943 echo "ARTIFACT_ID=$ARTIFACT_ID" >> "$GITHUB_ENV"
3044
3145 PR_NUMBER=$(gh api "/repos/$OWNER/$REPO/commits/${{ github.event.workflow_run.head_sha }}/pulls" --jq '.[0].number')
@@ -37,15 +51,15 @@ jobs:
3751 - name : Download artifact
3852 if : env.PR_NUMBER != 'null' && env.ARTIFACT_ID != ''
3953 run : |
40- gh api /repos/${{ github.repository }}/actions/artifacts/${{ env.ARTIFACT_ID }}/zip -H "Accept: application/vnd.github.v3+json" - -output artifact.zip
54+ gh api /repos/${{ github.repository }}/actions/artifacts/${{ env.ARTIFACT_ID }}/zip --output artifact.zip
4155 unzip artifact.zip
4256 rm artifact.zip
4357
4458 - name : Update Comment
4559 if : env.PR_NUMBER != 'null' && env.ARTIFACT_ID != ''
4660 env :
4761 JOB_PATH : " ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ env.PREVIOUS_JOB_ID }}"
48- ARTIFACT_URL : " ${{ github.server_url }}/${{ github.repository }}/suites/${{ env.SUITE_ID }} /artifacts/${{ env.ARTIFACT_ID }}"
62+ ARTIFACT_DL : " ${{ github.server_url }}/${{ github.repository }}/actions /artifacts/${{ env.ARTIFACT_ID }}"
4963 uses : actions/github-script@v6
5064 with :
5165 github-token : ${{secrets.GITHUB_TOKEN}}
@@ -65,11 +79,11 @@ jobs:
6579 | -------- | ----------------------- |
6680 | Commit | ${process.env.HEAD_SHA} |
6781 | Logs | ${process.env.JOB_PATH} |
68- | Download | ${process.env.ARTIFACT_URL } |
82+ | Download | ${process.env.ARTIFACT_DL } |
6983
7084 ### Detailed Evolution Plot
7185 
7286
73- [badge]: https://img.shields.io/badge/Build_Success!-0d1117?style=for-the-badge&labelColor=3fb950&logo=data:image/svg%2bxml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCIgd2lkdGg9IjI0IiBoZWlnaHQ9IjI0IiBmaWxsPSIjZmZmZmZmIj48cGF0aCBkPSJNMjEuMDMgNS43MmEuNzUuNzUgMCAwIDEgMCAxLjA2bC0xMS41IDExLjVhLjc0Ny43NDcgMCAwIDEtMS4wNzItLjAxMmwtNS41LTUuNzVhLjc1Ljc1IDAgMSAxIDEuMDg0LTEuMDM2bDQuOTcgNS4xOTVMMTkuOTcgNS43MmEuNzUuNzUgMCAwIDEgMS4wNiAwWiI+PC9wYXRoPjwvc3ZnPg==
87+ [badge]: https://img.shields.io/badge/Build_Success!-0d1117?style=for-the-badge&labelColor=3fb950
7488 `
75- })
89+ })
0 commit comments