File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -71,13 +71,22 @@ jobs:
7171 name : preview-readme-md
7272 path : README.md
7373 retention-days : 3
74- - name : Comment to PR with artifact link
74+
75+ - name : Fetch artifact URL
76+ id : artifact
7577 env :
7678 GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
7779 run : |
78- ARTIFACT_URL=$(gh api repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/artifacts \
79- --jq '.artifacts[] | select(.name == "preview-readme-md") | .archive_download_url')
80+ ARTIFACT_ID=$(gh api repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/artifacts \
81+ --jq '.artifacts[] | select(.name == "preview-readme-md") | .id')
82+ echo "url=https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}/artifacts/$ARTIFACT_ID" >> $GITHUB_OUTPUT
83+
84+ - name : Comment with full artifact link
85+ uses : peter-evans/create-or-update-comment@v4
86+ if : github.event_name == 'pull_request'
87+ with :
88+ issue-number : ${{ github.event.pull_request.number }}
89+ body : |
90+ ✅ [Download preview-readme-md artifact](${{ steps.artifact.outputs.url }})
8091
81- gh pr comment ${{ github.event.pull_request.number }} \
82- --body "✅ [Download preview-readme-md Artifact]($ARTIFACT_URL)"
8392
You can’t perform that action at this time.
0 commit comments