mirror of
https://github.com/github/codeql-action
synced 2026-05-23 20:00:54 +03:00
Only emit one message with accumulated property names
This commit is contained in:
Generated
+8
-3
@@ -104438,6 +104438,7 @@ async function loadPropertiesFromApi(logger, repositoryNwo) {
|
|||||||
`Retrieved ${remoteProperties.length} repository properties: ${remoteProperties.map((p) => p.property_name).join(", ")}`
|
`Retrieved ${remoteProperties.length} repository properties: ${remoteProperties.map((p) => p.property_name).join(", ")}`
|
||||||
);
|
);
|
||||||
const properties = {};
|
const properties = {};
|
||||||
|
const unrecognisedProperties = [];
|
||||||
for (const property of remoteProperties) {
|
for (const property of remoteProperties) {
|
||||||
if (property.property_name === void 0) {
|
if (property.property_name === void 0) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
@@ -104447,9 +104448,7 @@ async function loadPropertiesFromApi(logger, repositoryNwo) {
|
|||||||
if (isKnownPropertyName(property.property_name)) {
|
if (isKnownPropertyName(property.property_name)) {
|
||||||
setProperty2(properties, property.property_name, property.value, logger);
|
setProperty2(properties, property.property_name, property.value, logger);
|
||||||
} else if (property.property_name.startsWith(GITHUB_CODEQL_PROPERTY_PREFIX) && !isDynamicWorkflow()) {
|
} else if (property.property_name.startsWith(GITHUB_CODEQL_PROPERTY_PREFIX) && !isDynamicWorkflow()) {
|
||||||
logger.warning(
|
unrecognisedProperties.push(property.property_name);
|
||||||
`Found a repository property named '${property.property_name}', which looks like a CodeQL Action repository property, but which is not understood by this version of the CodeQL Action. Do you need to update to a newer version?`
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (Object.keys(properties).length === 0) {
|
if (Object.keys(properties).length === 0) {
|
||||||
@@ -104464,6 +104463,12 @@ async function loadPropertiesFromApi(logger, repositoryNwo) {
|
|||||||
logger.debug(` ${property}: ${value}`);
|
logger.debug(` ${property}: ${value}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (unrecognisedProperties.length > 0) {
|
||||||
|
const unrecognisedPropertyList = unrecognisedProperties.map((name) => `'${name}'`).join(", ");
|
||||||
|
logger.warning(
|
||||||
|
`Found repository properties (${unrecognisedPropertyList}), which look like CodeQL Action repository properties, but which are not understood by this version of the CodeQL Action. Do you need to update to a newer version?`
|
||||||
|
);
|
||||||
|
}
|
||||||
return properties;
|
return properties;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
|
|||||||
@@ -227,7 +227,7 @@ test.serial(
|
|||||||
warningSpy.firstCall.args[0]
|
warningSpy.firstCall.args[0]
|
||||||
.toString()
|
.toString()
|
||||||
.startsWith(
|
.startsWith(
|
||||||
`Found a repository property named '${propertyName}', which looks like a CodeQL Action repository property`,
|
`Found repository properties ('${propertyName}'), which look like CodeQL Action repository properties`,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -118,6 +118,8 @@ export async function loadPropertiesFromApi(
|
|||||||
);
|
);
|
||||||
|
|
||||||
const properties: RepositoryProperties = {};
|
const properties: RepositoryProperties = {};
|
||||||
|
const unrecognisedProperties: string[] = [];
|
||||||
|
|
||||||
for (const property of remoteProperties) {
|
for (const property of remoteProperties) {
|
||||||
if (property.property_name === undefined) {
|
if (property.property_name === undefined) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
@@ -131,12 +133,7 @@ export async function loadPropertiesFromApi(
|
|||||||
property.property_name.startsWith(GITHUB_CODEQL_PROPERTY_PREFIX) &&
|
property.property_name.startsWith(GITHUB_CODEQL_PROPERTY_PREFIX) &&
|
||||||
!isDynamicWorkflow()
|
!isDynamicWorkflow()
|
||||||
) {
|
) {
|
||||||
logger.warning(
|
unrecognisedProperties.push(property.property_name);
|
||||||
`Found a repository property named '${property.property_name}', ` +
|
|
||||||
"which looks like a CodeQL Action repository property, " +
|
|
||||||
"but which is not understood by this version of the CodeQL Action. " +
|
|
||||||
"Do you need to update to a newer version?",
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -153,6 +150,20 @@ export async function loadPropertiesFromApi(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Emit a warning if we encountered unrecognised properties that have our prefix.
|
||||||
|
if (unrecognisedProperties.length > 0) {
|
||||||
|
const unrecognisedPropertyList = unrecognisedProperties
|
||||||
|
.map((name) => `'${name}'`)
|
||||||
|
.join(", ");
|
||||||
|
|
||||||
|
logger.warning(
|
||||||
|
`Found repository properties (${unrecognisedPropertyList}), ` +
|
||||||
|
"which look like CodeQL Action repository properties, " +
|
||||||
|
"but which are not understood by this version of the CodeQL Action. " +
|
||||||
|
"Do you need to update to a newer version?",
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
return properties;
|
return properties;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
|
|||||||
Reference in New Issue
Block a user