Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit 8016b34

Browse files
committed
Just upload the PR object itself
We don't know what secret info might end up in the context
1 parent bbdee0d commit 8016b34

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

.github/workflows/layered-build.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@ jobs:
2020
with:
2121
script: |
2222
var fs = require('fs');
23-
fs.writeFileSync('${{github.workspace}}/context.json', JSON.stringify(context));
24-
- name: Upload Context
23+
fs.writeFileSync('${{github.workspace}}/pr.json', JSON.stringify(context.payload.pull_request));
24+
- name: Upload PR Info
2525
uses: actions/upload-artifact@v2
2626
with:
27-
name: context.json
28-
path: context.json
27+
name: pr.json
28+
path: pr.json
2929
# We'll only use this in a triggered job, then we're done with it
3030
retention-days: 1
3131

.github/workflows/netflify.yaml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,27 +34,27 @@ jobs:
3434
var fs = require('fs');
3535
fs.writeFileSync('${{github.workspace}}/previewbuild.zip', Buffer.from(download.data));
3636
37-
var contextArtifact = artifacts.data.artifacts.filter((artifact) => {
38-
return artifact.name == "context.json"
37+
var prInfoArtifact = artifacts.data.artifacts.filter((artifact) => {
38+
return artifact.name == "pr.json"
3939
})[0];
4040
var download = await github.actions.downloadArtifact({
4141
owner: context.repo.owner,
4242
repo: context.repo.repo,
43-
artifact_id: contextArtifact.id,
43+
artifact_id: prInfoArtifact.id,
4444
archive_format: 'zip',
4545
});
4646
var fs = require('fs');
47-
fs.writeFileSync('${{github.workspace}}/context.json.zip', Buffer.from(download.data));
47+
fs.writeFileSync('${{github.workspace}}/pr.json.zip', Buffer.from(download.data));
4848
- name: Extract Artifacts
49-
run: unzip -d webapp previewbuild.zip && rm previewbuild.zip && unzip context.json && rm context.json.zip
50-
- name: 'Read Context'
49+
run: unzip -d webapp previewbuild.zip && rm previewbuild.zip && unzip pr.json.zip && rm pr.json.zip
50+
- name: 'Read PR Info'
5151
id: readctx
5252
uses: actions/[email protected]
5353
with:
5454
script: |
5555
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}`);
56+
var pr = JSON.parse(fs.readFileSync('${{github.workspace}}/pr.json'));
57+
console.log(`::set-output name=prnumber::${pr.number}`);
5858
- name: Deploy to Netlify
5959
id: netlify
6060
uses: nwtgck/[email protected]

0 commit comments

Comments
 (0)