Conversation
ljharb
left a comment
There was a problem hiding this comment.
isn't there a risk here that anyone can get any content deployed under tc39.es just by making a PR?
In a sense, yes—and AFAICT, fundamental to the request of #30. This implementation publishes to https://tc39.es/$repo_name/pr/$digits the result of any successful Are there missing safeguards that you'd like? And if so, can you describe them? As for the style suggestions, I don't feel strongly but would point out that the line breaks were inserted by Prettier with default settings. |
|
yes, prettier often produces ugly code, unfortunately. (a line break should never ever ever appear after a re the safeguards, i'm not sure if we even need any, i just wanted to bring it up :-) |
|
@gibson042 Is there a reason this uses a lot of JS to download the artifact for publishing instead of |
Yes, in fact there are multiple reasons:
And the JS only looks like "a lot" for the first point (and to a lesser extent from Prettier): const { listWorkflowRunArtifacts, downloadArtifact } = github.rest.actions;
const { owner, repo } = context.repo;
const run_id = ${{ github.event.workflow_run.id }};
const name = process.env.ARTIFACT_NAME;
const listArtifactsParams = { owner, repo, run_id, name };
const listArtifactsResponse = await listWorkflowRunArtifacts(listArtifactsParams);
const { total_count, artifacts } = listArtifactsResponse.data;
// …error handling…
const artifact_id = artifacts[0].id;
console.log(`downloading artifact ${artifact_id}`);
const downloadParams = { owner, repo, artifact_id, archive_format: 'zip' };
const downloadResponse = await downloadArtifact(downloadParams);
const fs = require('fs');
fs.writeFileSync('${{ github.workspace }}/result.zip', Buffer.from(downloadResponse.data)); |
|
@gibson042 would this technique perhaps fix previews on the main spec? |
|
Yes.
|
Fixes #30
Preview Warning