1
0
mirror of https://github.com/actions/labeler synced 2026-05-05 03:07:49 +02:00

Improved Error message for missing config file (#475)

* error message for missing config

* chore: formatting and index js

* chore: update json5

* changes from cr

Co-authored-by: AndreiLobanovich <andreilobanovich@github.com>

* chore: recreate dist.js

* chore: revert package-lock

* chore: newline fix

---------

Co-authored-by: AndreiLobanovich <andreilobanovich@github.com>
This commit is contained in:
Lukas Hennies
2023-06-30 12:09:04 +02:00
committed by GitHub
parent 0967ca812e
commit e3c0d9b6cc
3 changed files with 23 additions and 6 deletions

View File

@@ -133,10 +133,17 @@ async function getLabelGlobs(
client: ClientType,
configurationPath: string
): Promise<Map<string, StringOrMatchConfig[]>> {
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);