@@ -84,13 +84,13 @@ async function parseChangesetFile(changesetFile: string) {
84
84
}
85
85
86
86
async function main ( ) {
87
- let formattedStatusError : string = '' ;
88
- let missingPackagesError : string = '' ;
87
+ const errors = [ ] ;
89
88
try {
90
89
await exec ( 'yarn changeset status' ) ;
91
90
} catch ( e ) {
92
91
const messageLines = e . message . replace ( / 🦋 e r r o r / g, '' ) . split ( '\n' ) ;
93
- formattedStatusError = '- Changeset formatting error in following file:%0A' ;
92
+ let formattedStatusError =
93
+ '- Changeset formatting error in following file:%0A' ;
94
94
formattedStatusError += ' ```%0A' ;
95
95
formattedStatusError += messageLines
96
96
. filter (
@@ -101,6 +101,7 @@ async function main() {
101
101
. map ( ( line : string ) => ` ${ line } ` )
102
102
. join ( '%0A' ) ;
103
103
formattedStatusError += '%0A ```%0A' ;
104
+ errors . push ( formattedStatusError ) ;
104
105
/**
105
106
* Sets Github Actions output for a step. Pass changeset error message to next
106
107
* step. See:
@@ -127,7 +128,7 @@ async function main() {
127
128
}
128
129
missingPackagesLines . push ( '' ) ;
129
130
missingPackagesLines . push ( ' Make sure this was intentional.' ) ;
130
- missingPackagesError = missingPackagesLines . join ( '%0A' ) ;
131
+ errors . push ( missingPackagesLines . join ( '%0A' ) ) ;
131
132
}
132
133
}
133
134
} catch ( e ) {
@@ -140,12 +141,10 @@ async function main() {
140
141
* step. See:
141
142
* https://github.com/actions/toolkit/blob/master/docs/commands.md#set-outputs
142
143
*/
143
- console . log (
144
- `::set-output name=CHANGESET_ERROR_MESSAGE::${ [
145
- formattedStatusError ,
146
- missingPackagesError
147
- ] . join ( '%0A' ) } `
148
- ) ;
144
+ if ( errors . length > 0 )
145
+ console . log (
146
+ `::set-output name=CHANGESET_ERROR_MESSAGE::${ errors . join ( '%0A' ) } `
147
+ ) ;
149
148
process . exit ( ) ;
150
149
}
151
150
0 commit comments