Skip to content

Commit b4937c1

Browse files
committed
Only emit one message with accumulated property names
1 parent a717db1 commit b4937c1

File tree

3 files changed

+26
-10
lines changed

3 files changed

+26
-10
lines changed

lib/init-action.js

Lines changed: 8 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/feature-flags/properties.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ test.serial(
227227
warningSpy.firstCall.args[0]
228228
.toString()
229229
.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`,
231231
),
232232
);
233233
},

src/feature-flags/properties.ts

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,8 @@ export async function loadPropertiesFromApi(
118118
);
119119

120120
const properties: RepositoryProperties = {};
121+
const unrecognisedProperties: string[] = [];
122+
121123
for (const property of remoteProperties) {
122124
if (property.property_name === undefined) {
123125
throw new Error(
@@ -131,12 +133,7 @@ export async function loadPropertiesFromApi(
131133
property.property_name.startsWith(GITHUB_CODEQL_PROPERTY_PREFIX) &&
132134
!isDynamicWorkflow()
133135
) {
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);
140137
}
141138
}
142139

@@ -153,6 +150,20 @@ export async function loadPropertiesFromApi(
153150
}
154151
}
155152

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+
156167
return properties;
157168
} catch (e) {
158169
throw new Error(

0 commit comments

Comments
 (0)