@@ -124,6 +124,12 @@ async function mergeIfLGTMAndHasAccess() {
124
124
}
125
125
}
126
126
127
+ /**
128
+ *
129
+ * @param {string } owner
130
+ * @param {string[] } files
131
+ * @param {string } cwd
132
+ */
127
133
function getFilesNotOwnedByCodeOwner ( owner , files , cwd ) {
128
134
const filesWhichArentOwned = [ ]
129
135
const codeowners = new Codeowners ( cwd ) ;
@@ -139,6 +145,11 @@ function getFilesNotOwnedByCodeOwner(owner, files, cwd) {
139
145
return filesWhichArentOwned
140
146
}
141
147
148
+ /**
149
+ *
150
+ * @param {string[] } files
151
+ * @param {string } cwd
152
+ */
142
153
function listFilesWithOwners ( files , cwd ) {
143
154
const codeowners = new Codeowners ( cwd ) ;
144
155
console . log ( "\nKnown code-owners for changed files:" )
@@ -181,8 +192,6 @@ async function getPRChangedFiles(octokit, repoDeets, prNumber) {
181
192
return fileStrings
182
193
}
183
194
184
-
185
-
186
195
async function createOrAddLabel ( octokit , repoDeets , labelConfig ) {
187
196
let label = null
188
197
const existingLabels = await octokit . paginate ( 'GET /repos/:owner/:repo/labels' , { owner : repoDeets . owner , repo : repoDeets . repo } )
@@ -207,10 +216,6 @@ async function createOrAddLabel(octokit, repoDeets, labelConfig) {
207
216
} )
208
217
}
209
218
210
- process . on ( 'uncaughtException' , function ( error ) {
211
- core . setFailed ( error . message )
212
- } )
213
-
214
219
module . exports = {
215
220
getFilesNotOwnedByCodeOwner,
216
221
findCodeOwnersForChangedFiles
@@ -225,3 +230,11 @@ if (!module.parent) {
225
230
throw error
226
231
}
227
232
}
233
+
234
+ // Bail correctly
235
+ process . on ( 'uncaughtException' , function ( err ) {
236
+ core . setFailed ( err . message )
237
+ console . error ( ( new Date ) . toUTCString ( ) + ' uncaughtException:' , err . message )
238
+ console . error ( err . stack )
239
+ process . exit ( 1 )
240
+ } )
0 commit comments