From ae538ebe3271a5039e047451aa4e950abc8b2780 Mon Sep 17 00:00:00 2001 From: Federico Builes Date: Wed, 9 Nov 2022 13:17:12 +0100 Subject: [PATCH] Linting and whitespace. Smol rename. --- src/config.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/config.ts b/src/config.ts index 0064fc7..9c097a9 100644 --- a/src/config.ts +++ b/src/config.ts @@ -92,12 +92,14 @@ function validateLicenses( async function readConfigFile( filePath: string ): Promise { + // match a remote config (e.g. 'owner/repo/filepath@someref') const format = new RegExp( '(?[^/]+)/(?[^/]+)/(?[^@]+)@(?.*)' ) - let data: string + let data: string const pieces = format.exec(filePath) + try { if (pieces?.groups && pieces.length === 5) { data = await getRemoteConfig({ @@ -139,8 +141,6 @@ async function getRemoteConfig(configOpts: { [key: string]: string }): Promise { try { - // https://github.com/github/codeql-action/blob/main/init/action.yml#L59 - // external-repo-token const {data} = await octokitClient( 'external-repo-token', false @@ -154,8 +154,9 @@ async function getRemoteConfig(configOpts: { ref: configOpts.ref }) - // When using mediaType.format = 'raw', the response.data is a string but this is not reflected - // in the return type of getContent. So we're casting the return value to a string. + // When using mediaType.format = 'raw', the response.data is a string + // but this is not reflected in the return type of getContent, so we're + // casting the return value to a string. return z.string().parse(data as unknown) } catch (error) { core.debug(error as string)