@@ -33,12 +33,33 @@ jobs:
3333 });
3434 var fs = require('fs');
3535 fs.writeFileSync('${{github.workspace}}/previewbuild.zip', Buffer.from(download.data));
36- - run : unzip previewbuild.zip && rm previewbuild.zip
36+
37+ var prInfoArtifact = artifacts.data.artifacts.filter((artifact) => {
38+ return artifact.name == "pr.json"
39+ })[0];
40+ var download = await github.actions.downloadArtifact({
41+ owner: context.repo.owner,
42+ repo: context.repo.repo,
43+ artifact_id: prInfoArtifact.id,
44+ archive_format: 'zip',
45+ });
46+ var fs = require('fs');
47+ fs.writeFileSync('${{github.workspace}}/pr.json.zip', Buffer.from(download.data));
48+ - name : Extract Artifacts
49+ run : unzip -d webapp previewbuild.zip && rm previewbuild.zip && unzip pr.json.zip && rm pr.json.zip
50+ - name : ' Read PR Info'
51+ id : readctx
52+ 53+ with :
54+ script : |
55+ var fs = require('fs');
56+ var pr = JSON.parse(fs.readFileSync('${{github.workspace}}/pr.json'));
57+ console.log(`::set-output name=prnumber::${pr.number}`);
3758 - name : Deploy to Netlify
3859 id : netlify
39604061 with :
41- publish-dir : .
62+ publish-dir : webapp
4263 deploy-message : " Deploy from GitHub Actions"
4364 # These don't work because we're in workflow_run
4465 enable-pull-request-comment : false
5172 uses :
phulsechinmay/[email protected] 5273 with :
5374 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
54- ISSUE_ID : ${{ github.event.workflow_run.pull_requests[0].number }}
75+ ISSUE_ID : ${{ steps.readctx.outputs.prnumber }}
5576 message : |
5677 Preview: ${{ steps.netlify.outputs.deploy-url }}
5778 ⚠️ Do you trust the author of this PR? Maybe this build will steal your keys or give you malware. Exercise caution. Use test accounts.
0 commit comments