Skip to content

Commit df16811

Browse files
authored
Do not block if no changesets present (#4231)
1 parent e13b794 commit df16811

File tree

1 file changed

+24
-20
lines changed

1 file changed

+24
-20
lines changed

scripts/check_changeset.ts

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -89,26 +89,30 @@ async function main() {
8989
await exec('yarn changeset status');
9090
console.log(`::set-output name=BLOCKING_FAILURE::false`);
9191
} catch (e) {
92-
const messageLines = e.message.replace(/🦋 error /g, '').split('\n');
93-
let formattedStatusError =
94-
'- Changeset formatting error in following file:%0A';
95-
formattedStatusError += ' ```%0A';
96-
formattedStatusError += messageLines
97-
.filter(
98-
(line: string) => !line.match(/^ at [\w\.]+ \(.+:[0-9]+:[0-9]+\)/)
99-
)
100-
.filter((line: string) => !line.includes('Command failed'))
101-
.filter((line: string) => !line.includes('exited with error code 1'))
102-
.map((line: string) => ` ${line}`)
103-
.join('%0A');
104-
formattedStatusError += '%0A ```%0A';
105-
errors.push(formattedStatusError);
106-
/**
107-
* Sets Github Actions output for a step. Pass changeset error message to next
108-
* step. See:
109-
* https://github.com/actions/toolkit/blob/master/docs/commands.md#set-outputs
110-
*/
111-
console.log(`::set-output name=BLOCKING_FAILURE::true`);
92+
if (e.message.match('No changesets present')) {
93+
console.log(`::set-output name=BLOCKING_FAILURE::false`);
94+
} else {
95+
const messageLines = e.message.replace(/🦋 error /g, '').split('\n');
96+
let formattedStatusError =
97+
'- Changeset formatting error in following file:%0A';
98+
formattedStatusError += ' ```%0A';
99+
formattedStatusError += messageLines
100+
.filter(
101+
(line: string) => !line.match(/^ at [\w\.]+ \(.+:[0-9]+:[0-9]+\)/)
102+
)
103+
.filter((line: string) => !line.includes('Command failed'))
104+
.filter((line: string) => !line.includes('exited with error code 1'))
105+
.map((line: string) => ` ${line}`)
106+
.join('%0A');
107+
formattedStatusError += '%0A ```%0A';
108+
errors.push(formattedStatusError);
109+
/**
110+
* Sets Github Actions output for a step. Pass changeset error message to next
111+
* step. See:
112+
* https://github.com/actions/toolkit/blob/master/docs/commands.md#set-outputs
113+
*/
114+
console.log(`::set-output name=BLOCKING_FAILURE::true`);
115+
}
112116
}
113117
try {
114118
const diffData = await getDiffData();

0 commit comments

Comments
 (0)