Fix handling of non-string values from repository properties API#3557
Merged
Fix handling of non-string values from repository properties API#3557
string values from repository properties API#3557Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Updates repository property handling to support API responses where value can be a string or string[], and validates/parses only properties that this action recognizes to avoid failing on unrelated properties.
Changes:
- Expand API response typing to allow
string | string[]for repository propertyvalue. - Refactor parsing to use per-property
validate+parse(PropertyInfo) and validate only for known properties. - Add/adjust unit tests to cover unknown properties with unexpected
valuetypes and updated error behavior.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 7 comments.
| File | Description |
|---|---|
| src/feature-flags/properties.ts | Introduces RepositoryPropertyValue and PropertyInfo-based validation/parsing to avoid throwing on unknown properties and to support future typed properties. |
| src/feature-flags/properties.test.ts | Updates existing tests and adds coverage ensuring unknown properties with unexpected value types don’t throw. |
| lib/init-action.js | Regenerated compiled bundle reflecting the TS changes. |
henrymercer
previously approved these changes
Mar 9, 2026
Contributor
henrymercer
left a comment
There was a problem hiding this comment.
Looks good! Consider adding a changelog note.
henrymercer
approved these changes
Mar 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #3555.
The repository property API will return repository property objects where the
valuefield is eitherstringorstring[]. We do not currently handle the latter.This PR makes the following changes:
string[]values.valueif it is for a property we care about. This also protects us against future changes to what types ofvaluemay be returned by the API.These two commits are enough to fix the bug. The third commit goes beyond this to enable us to use array-typed properties in the future by:
valuetypes (RepositoryPropertyApiType).repositoryPropertyParsersto return an object for each known property that contains both a validator function and a parser (PropertyInfo)..validate) accepts anyRepositoryPropertyValue(i.e.string | string[]), checks that it is the expected type, and narrows the type ofvalueif successful.valuetype validation is now insetProperty, which retrieves thePropertyInfoobject for the repository property, callsvalidate, and then is either able to callparseif the check was successful (and the type narrowed) or throws the validation error.Risk assessment
For internal use only. Please select the risk level of this change:
Which use cases does this change impact?
Workflow types:
dynamicworkflows (Default Setup, Code Quality, ...).Products:
analysis-kinds: code-scanning.analysis-kinds: code-quality.Environments:
github.comand/or GitHub Enterprise Cloud with Data Residency.How did/will you validate this change?
.test.tsfiles).pr-checks).If something goes wrong after this change is released, what are the mitigation and rollback strategies?
The repository properties feature is already FF-ed. If something goes wrong with this change, we can either disable the existing FF or perform a rollback.
How will you know if something goes wrong after this change is released?
Are there any special considerations for merging or releasing this change?
Merge / deployment checklist