Skip to content

Commit

Permalink
Do not block if no changesets present (#4231)
Browse files Browse the repository at this point in the history
  • Loading branch information
hsubox76 committed Dec 22, 2020
1 parent e13b794 commit df16811
Showing 1 changed file with 24 additions and 20 deletions.
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

0 comments on commit df16811

Please sign in to comment.