|
33 | 33 | }); |
34 | 34 | var fs = require('fs'); |
35 | 35 | fs.writeFileSync('${{github.workspace}}/previewbuild.zip', Buffer.from(download.data)); |
36 | | - - run: unzip previewbuild.zip && rm previewbuild.zip |
| 36 | +
|
| 37 | + var contextArtifact = artifacts.data.artifacts.filter((artifact) => { |
| 38 | + return artifact.name == "context.json" |
| 39 | + })[0]; |
| 40 | + var download = await github.actions.downloadArtifact({ |
| 41 | + owner: context.repo.owner, |
| 42 | + repo: context.repo.repo, |
| 43 | + artifact_id: contextArtifact.id, |
| 44 | + archive_format: 'zip', |
| 45 | + }); |
| 46 | + var fs = require('fs'); |
| 47 | + fs.writeFileSync('${{github.workspace}}/context.json.zip', Buffer.from(download.data)); |
| 48 | + - name: Extract Artifacts |
| 49 | + run: unzip -d webapp previewbuild.zip && rm previewbuild.zip && unzip context.json && rm context.json.zip |
| 50 | + - name: 'Read Context' |
| 51 | + id: readctx |
| 52 | + |
| 53 | + with: |
| 54 | + script: | |
| 55 | + var fs = require('fs'); |
| 56 | + var ctx = JSON.parse(fs.readFileSync('${{github.workspace}}/context.json')); |
| 57 | + console.log(`::set-output name=prnumber::${ctx.payload.pull_request.number}`); |
37 | 58 | - name: Deploy to Netlify |
38 | 59 | id: netlify |
39 | 60 | |
|
51 | 72 | uses: phulsechinmay/[email protected] |
52 | 73 | with: |
53 | 74 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
54 | | - ISSUE_ID: ${{ github.event.workflow_run.pull_requests[0].number }} |
| 75 | + ISSUE_ID: ${{ steps.readctx.outputs.prnumber }} |
55 | 76 | message: | |
56 | 77 | Preview: ${{ steps.netlify.outputs.deploy-url }} |
57 | 78 | ⚠️ 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