diff --git a/.gitignore b/.gitignore index 867d24a5..d7590431 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ .DS_Store node_modules/ -lib/ \ No newline at end of file +lib/ +.idea \ No newline at end of file diff --git a/dist/index.js b/dist/index.js index 28b173dd..20509a5f 100644 --- a/dist/index.js +++ b/dist/index.js @@ -138,7 +138,16 @@ function getChangedFiles(client, prNumber) { } function getLabelGlobs(client, configurationPath) { return __awaiter(this, void 0, void 0, function* () { - const configurationContent = yield fetchContent(client, configurationPath); + let configurationContent; + try { + configurationContent = yield fetchContent(client, configurationPath); + } + catch (e) { + if (e.name == 'HttpError' || e.name == 'NotFound') { + core.warning(`The config file was not found at ${configurationPath}. Make sure it exists and that this action has the correct access rights.`); + } + throw e; + } // loads (hopefully) a `{[label:string]: string | StringOrMatchConfig[]}`, but is `any`: const configObject = yaml.load(configurationContent); // transform `any` => `Map` or throw if yaml is malformed: diff --git a/src/labeler.ts b/src/labeler.ts index 4aac4dd6..d1dc601f 100644 --- a/src/labeler.ts +++ b/src/labeler.ts @@ -133,10 +133,17 @@ async function getLabelGlobs( client: ClientType, configurationPath: string ): Promise> { - const configurationContent: string = await fetchContent( - client, - configurationPath - ); + let configurationContent: string; + try { + configurationContent = await fetchContent(client, configurationPath); + } catch (e: any) { + if (e.name == 'HttpError' || e.name == 'NotFound') { + core.warning( + `The config file was not found at ${configurationPath}. Make sure it exists and that this action has the correct access rights.` + ); + } + throw e; + } // loads (hopefully) a `{[label:string]: string | StringOrMatchConfig[]}`, but is `any`: const configObject: any = yaml.load(configurationContent);