1+ import { isDynamicWorkflow } from "../actions-util" ;
12import { getRepositoryProperties } from "../api-client" ;
23import { Logger } from "../logging" ;
34import { RepositoryNwo } from "../repository" ;
45
6+ /** The common prefix that we expect all of our repository properties to have. */
7+ export const GITHUB_CODEQL_PROPERTY_PREFIX = "github-codeql-" ;
8+
59/**
610 * Enumerates repository property names that have some meaning to us.
711 */
@@ -114,6 +118,8 @@ export async function loadPropertiesFromApi(
114118 ) ;
115119
116120 const properties : RepositoryProperties = { } ;
121+ const unrecognisedProperties : string [ ] = [ ] ;
122+
117123 for ( const property of remoteProperties ) {
118124 if ( property . property_name === undefined ) {
119125 throw new Error (
@@ -123,6 +129,11 @@ export async function loadPropertiesFromApi(
123129
124130 if ( isKnownPropertyName ( property . property_name ) ) {
125131 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 ) ;
126137 }
127138 }
128139
@@ -139,6 +150,20 @@ export async function loadPropertiesFromApi(
139150 }
140151 }
141152
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+
142167 return properties ;
143168 } catch ( e ) {
144169 throw new Error (
0 commit comments