-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[actions] Publish PR previews #38
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isn't there a risk here that anyone can get any content deployed under tc39.es just by making a PR?
const listArtifactsResponse = | ||
await github.rest.actions.listWorkflowRunArtifacts(listArtifactsQuery); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const listArtifactsResponse = | |
await github.rest.actions.listWorkflowRunArtifacts(listArtifactsQuery); | |
const listArtifactsResponse = await github.rest.actions.listWorkflowRunArtifacts(listArtifactsQuery); |
const summary = artifacts?.map(artifact => { | ||
const { name, size_in_bytes, url } = artifact; | ||
return { name, size_in_bytes, url }; | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe?
const summary = artifacts?.map(artifact => { | |
const { name, size_in_bytes, url } = artifact; | |
return { name, size_in_bytes, url }; | |
}); | |
const summary = artifacts?.map(({ name, size_in_bytes, url }) => ({ name, size_in_bytes, url })); |
const listArtifactsResponse = | ||
await github.rest.actions.listWorkflowRunArtifacts({ owner, repo, run_id }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const listArtifactsResponse = | |
await github.rest.actions.listWorkflowRunArtifacts({ owner, repo, run_id }); | |
const listArtifactsResponse = await github.rest.actions.listWorkflowRunArtifacts({ owner, repo, run_id }); |
formatErrors.push(SyntaxError(`bad placeholder at index ${i}: ${trunc}`)); | ||
} else if (!Object.hasOwn(data, name)) { | ||
formatErrors.push(ReferenceError(`no data for ${m}`)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
formatErrors.push(SyntaxError(`bad placeholder at index ${i}: ${trunc}`)); | |
} else if (!Object.hasOwn(data, name)) { | |
formatErrors.push(ReferenceError(`no data for ${m}`)); | |
formatErrors.push(new SyntaxError(`bad placeholder at index ${i}: ${trunc}`)); | |
} else if (!Object.hasOwn(data, name)) { | |
formatErrors.push(new ReferenceError(`no data for ${m}`)); |
} | ||
return data[name]; | ||
}); | ||
if (formatErrors.length > 0) throw AggregateError(formatErrors); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (formatErrors.length > 0) throw AggregateError(formatErrors); | |
if (formatErrors.length > 0) throw new AggregateError(formatErrors); |
const stayInHead = new Set([ | ||
...['base', 'basefont', 'bgsound', 'link', 'meta', 'title'], | ||
...['noscript', 'noframes', 'style', 'script', 'template'], | ||
'head', | ||
]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const stayInHead = new Set([ | |
...['base', 'basefont', 'bgsound', 'link', 'meta', 'title'], | |
...['noscript', 'noframes', 'style', 'script', 'template'], | |
'head', | |
]); | |
const stayInHead = new Set([].concat( | |
['base', 'basefont', 'bgsound', 'link', 'meta', 'title'], | |
['noscript', 'noframes', 'style', 'script', 'template'], | |
'head', | |
)); |
const results = await Promise.allSettled(work); | ||
|
||
const failures = results.filter(result => result.status !== 'fulfilled'); | ||
if (failures.length > 0) throw AggregateError(failures.map(r => r.reason)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (failures.length > 0) throw AggregateError(failures.map(r => r.reason)); | |
if (failures.length > 0) throw new AggregateError(failures.map(r => r.reason)); |
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 :-) |
Fixes #30
Preview Warning