Only emit one message with accumulated property names · github/codeql-action@b4937c1 (original) (raw)

Original file line number Diff line number Diff line change
@@ -227,7 +227,7 @@ test.serial(
227 227 warningSpy.firstCall.args[0]
228 228 .toString()
229 229 .startsWith(
230 -`Found a repository property named '${propertyName}', which looks like a CodeQL Action repository property`,
230 +`Found repository properties ('${propertyName}'), which look like CodeQL Action repository properties`,
231 231 ),
232 232 );
233 233 },
Original file line number Diff line number Diff line change
@@ -118,6 +118,8 @@ export async function loadPropertiesFromApi(
118 118 );
119 119
120 120 const properties: RepositoryProperties = {};
121 +const unrecognisedProperties: string[] = [];
122 +
121 123 for (const property of remoteProperties) {
122 124 if (property.property_name === undefined) {
123 125 throw new Error(
@@ -131,12 +133,7 @@ export async function loadPropertiesFromApi(
131 133 property.property_name.startsWith(GITHUB_CODEQL_PROPERTY_PREFIX) &&
132 134 !isDynamicWorkflow()
133 135 ) {
134 -logger.warning(
135 -`Found a repository property named '${property.property_name}', ` +
136 -"which looks like a CodeQL Action repository property, " +
137 -"but which is not understood by this version of the CodeQL Action. " +
138 -"Do you need to update to a newer version?",
139 -);
136 +unrecognisedProperties.push(property.property_name);
140 137 }
141 138 }
142 139
@@ -153,6 +150,20 @@ export async function loadPropertiesFromApi(
153 150 }
154 151 }
155 152
153 +// Emit a warning if we encountered unrecognised properties that have our prefix.
154 +if (unrecognisedProperties.length > 0) {
155 +const unrecognisedPropertyList = unrecognisedProperties
156 +.map((name) => `'${name}'`)
157 +.join(", ");
158 +
159 +logger.warning(
160 +`Found repository properties (${unrecognisedPropertyList}), ` +
161 +"which look like CodeQL Action repository properties, " +
162 +"but which are not understood by this version of the CodeQL Action. " +
163 +"Do you need to update to a newer version?",
164 +);
165 +}
166 +
156 167 return properties;
157 168 } catch (e) {
158 169 throw new Error(