| @@ -1,7 +1,11 @@ |
|
|
|
1 |
+import { isDynamicWorkflow } from "../actions-util"; |
| 1 |
2 |
import { getRepositoryProperties } from "../api-client"; |
| 2 |
3 |
import { Logger } from "../logging"; |
| 3 |
4 |
import { RepositoryNwo } from "../repository"; |
| 4 |
5 |
|
|
6 |
+/** The common prefix that we expect all of our repository properties to have. */ |
|
7 |
+export const GITHUB_CODEQL_PROPERTY_PREFIX = "github-codeql-"; |
|
8 |
+ |
| 5 |
9 |
/** |
| 6 |
10 |
* Enumerates repository property names that have some meaning to us. |
| 7 |
11 |
*/ |
| @@ -114,6 +118,8 @@ export async function loadPropertiesFromApi( |
|
|
| 114 |
118 |
); |
| 115 |
119 |
|
| 116 |
120 |
const properties: RepositoryProperties = {}; |
|
121 |
+const unrecognisedProperties: string[] = []; |
|
122 |
+ |
| 117 |
123 |
for (const property of remoteProperties) { |
| 118 |
124 |
if (property.property_name === undefined) { |
| 119 |
125 |
throw new Error( |
| @@ -123,6 +129,11 @@ export async function loadPropertiesFromApi( |
|
|
| 123 |
129 |
|
| 124 |
130 |
if (isKnownPropertyName(property.property_name)) { |
| 125 |
131 |
setProperty(properties, property.property_name, property.value, logger); |
|
132 |
+} else if ( |
|
133 |
+property.property_name.startsWith(GITHUB_CODEQL_PROPERTY_PREFIX) && |
|
134 |
+!isDynamicWorkflow() |
|
135 |
+) { |
|
136 |
+unrecognisedProperties.push(property.property_name); |
| 126 |
137 |
} |
| 127 |
138 |
} |
| 128 |
139 |
|
| @@ -139,6 +150,20 @@ export async function loadPropertiesFromApi( |
|
|
| 139 |
150 |
} |
| 140 |
151 |
} |
| 141 |
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 |
+ |
| 142 |
167 |
return properties; |
| 143 |
168 |
} catch (e) { |
| 144 |
169 |
throw new Error( |