Linting and whitespace. Smol rename.
This commit is contained in:
+6
-5
@@ -92,12 +92,14 @@ function validateLicenses(
|
|||||||
async function readConfigFile(
|
async function readConfigFile(
|
||||||
filePath: string
|
filePath: string
|
||||||
): Promise<ConfigurationOptionsPartial> {
|
): Promise<ConfigurationOptionsPartial> {
|
||||||
|
// match a remote config (e.g. 'owner/repo/filepath@someref')
|
||||||
const format = new RegExp(
|
const format = new RegExp(
|
||||||
'(?<owner>[^/]+)/(?<repo>[^/]+)/(?<path>[^@]+)@(?<ref>.*)'
|
'(?<owner>[^/]+)/(?<repo>[^/]+)/(?<path>[^@]+)@(?<ref>.*)'
|
||||||
)
|
)
|
||||||
let data: string
|
|
||||||
|
|
||||||
|
let data: string
|
||||||
const pieces = format.exec(filePath)
|
const pieces = format.exec(filePath)
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (pieces?.groups && pieces.length === 5) {
|
if (pieces?.groups && pieces.length === 5) {
|
||||||
data = await getRemoteConfig({
|
data = await getRemoteConfig({
|
||||||
@@ -139,8 +141,6 @@ async function getRemoteConfig(configOpts: {
|
|||||||
[key: string]: string
|
[key: string]: string
|
||||||
}): Promise<string> {
|
}): Promise<string> {
|
||||||
try {
|
try {
|
||||||
// https://github.com/github/codeql-action/blob/main/init/action.yml#L59
|
|
||||||
// external-repo-token
|
|
||||||
const {data} = await octokitClient(
|
const {data} = await octokitClient(
|
||||||
'external-repo-token',
|
'external-repo-token',
|
||||||
false
|
false
|
||||||
@@ -154,8 +154,9 @@ async function getRemoteConfig(configOpts: {
|
|||||||
ref: configOpts.ref
|
ref: configOpts.ref
|
||||||
})
|
})
|
||||||
|
|
||||||
// When using mediaType.format = 'raw', the response.data is a string but this is not reflected
|
// When using mediaType.format = 'raw', the response.data is a string
|
||||||
// in the return type of getContent. So we're casting the return value to 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)
|
return z.string().parse(data as unknown)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
core.debug(error as string)
|
core.debug(error as string)
|
||||||
|
|||||||
Reference in New Issue
Block a user