Skip to content

Do not block if no changesets present #4231

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

Merged
merged 1 commit into from
Dec 22, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 24 additions & 20 deletions scripts/check_changeset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,26 +89,30 @@ async function main() {
await exec('yarn changeset status');
console.log(`::set-output name=BLOCKING_FAILURE::false`);
} catch (e) {
const messageLines = e.message.replace(/🦋 error /g, '').split('\n');
let formattedStatusError =
'- Changeset formatting error in following file:%0A';
formattedStatusError += ' ```%0A';
formattedStatusError += messageLines
.filter(
(line: string) => !line.match(/^ at [\w\.]+ \(.+:[0-9]+:[0-9]+\)/)
)
.filter((line: string) => !line.includes('Command failed'))
.filter((line: string) => !line.includes('exited with error code 1'))
.map((line: string) => ` ${line}`)
.join('%0A');
formattedStatusError += '%0A ```%0A';
errors.push(formattedStatusError);
/**
* Sets Github Actions output for a step. Pass changeset error message to next
* step. See:
* https://github.com/actions/toolkit/blob/master/docs/commands.md#set-outputs
*/
console.log(`::set-output name=BLOCKING_FAILURE::true`);
if (e.message.match('No changesets present')) {
console.log(`::set-output name=BLOCKING_FAILURE::false`);
} else {
const messageLines = e.message.replace(/🦋 error /g, '').split('\n');
let formattedStatusError =
'- Changeset formatting error in following file:%0A';
formattedStatusError += ' ```%0A';
formattedStatusError += messageLines
.filter(
(line: string) => !line.match(/^ at [\w\.]+ \(.+:[0-9]+:[0-9]+\)/)
)
.filter((line: string) => !line.includes('Command failed'))
.filter((line: string) => !line.includes('exited with error code 1'))
.map((line: string) => ` ${line}`)
.join('%0A');
formattedStatusError += '%0A ```%0A';
errors.push(formattedStatusError);
/**
* Sets Github Actions output for a step. Pass changeset error message to next
* step. See:
* https://github.com/actions/toolkit/blob/master/docs/commands.md#set-outputs
*/
console.log(`::set-output name=BLOCKING_FAILURE::true`);
}
}
try {
const diffData = await getDiffData();
Expand Down