File tree Expand file tree Collapse file tree 2 files changed +19
-4
lines changed Expand file tree Collapse file tree 2 files changed +19
-4
lines changed Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ permissions:
1313jobs :
1414 notify :
1515 runs-on : ubuntu-latest
16- if : ${{ github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.pull_requests.length > 0 }}
16+ if : ${{ github.event.workflow_run.event == 'pull_request' }}
1717 steps :
1818 - uses : actions/github-script@v7
1919 with :
2828 throw new Error('Expected one artifact')
2929 }
3030
31- const pullNumber = context.payload.workflow_run.pull_requests[0].number;
32- const artifactId = artifacts.data.artifacts[0].id;
33- const artifactUrl = `${context.payload.workflow_run.html_url}/artifacts/${artifactId}`;
31+ const artifact = artifacts.data.artifacts[0];
32+ const download = await github.rest.actions.downloadArtifact({
33+ owner: context.repo.owner,
34+ repo: context.repo.repo,
35+ artifact_id: artifact.id,
36+ archive_format: 'zip'
37+ });
38+
39+ const zlib = require('zlib');
40+ const zip = zlib.unzipSync(Buffer.from(download.data));
41+ const ghInfo = JSON.parse(zip.toString());
42+ const pullNumber = ghInfo.number;
43+
44+ const artifactUrl = `${context.payload.workflow_run.html_url}/artifacts/${artifact.id}`;
3445 const commentBody = `<!-- build-artifact-comment -->\n📦 Docs artifacts are ready: ${artifactUrl}`;
3546
3647 const comments = await github.rest.issues.listComments({
Original file line number Diff line number Diff line change 4141 - name : Generate docs
4242 run : test/prerelease.sh
4343
44+ - name : Attach docs metadata
45+ run : |
46+ echo "{\"pr_number\":${{ github.event.number }},\"artifact_id\":${{ steps.docs-upload.outputs.artifact-id }}}" > test/tmp/contents/doc/gh.json
47+
4448 - name : Upload docs
4549 uses : actions/upload-artifact@v4
4650 id : docs-upload
You can’t perform that action at this time.
0 commit comments