-
Couldn't load subscription status.
- Fork 412
Add support for the repository properties API #3126
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
b8fc51c to
8cba882
Compare
8cba882 to
c7eb488
Compare
96ca55b to
a067418
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds support for the Repository Properties API to the CodeQL Action, enabling organization-wide query configuration through repository properties.
Key changes:
- Adds Repository Properties API integration to fetch property values during initialization
- Implements query precedence system where repository properties have highest priority, followed by action inputs, then config file settings
- Introduces combining logic for repository property queries similar to existing action inputs
Reviewed Changes
Copilot reviewed 22 out of 22 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/feature-flags/properties.ts | New module for Repository Properties API integration and property name enumeration |
| src/init-action.ts | Adds repository properties loading during action initialization |
| src/config/db-config.ts | Implements query combination logic with repository property precedence |
| src/error-messages.ts | Adds error message functions for repository property validation |
| src/config-utils.ts | Updates Config interface and initialization to include repository properties |
| src/testing-utils.ts | Updates test utilities to include repository properties field |
| package.json | Simplifies test script pattern matching |
| lib/*.js | Generated JavaScript files reflecting the TypeScript changes |
| .github/actions/check-codescanning-config/index.ts | Adds query array sorting for deterministic config comparison |
Co-authored-by: Copilot <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like some additional config normalisation is needed in the tests, otherwise LGTM.
840c9ad to
05310c6
Compare
Also add `logger.debug` call with keys from API response
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks reasonable, and the test run checks out.
This PR has two main contributions:
queriesinput can be used.For the Repository Properties support, we fetch the list of repository properties at the start of the
initAction. We filter this down to known properties (i.e. ones we care about) and store their values. The mapping of known property names to their values is then included in the Action state (i.e. theConfigtype) so that it remains accessible to other CodeQL Action steps in the same workflow and with consistent values.For the query augmentation, we give the value obtained from the Repository Properties the highest precedence. This is because the intention here is to allow organisations to configure org-wide queries to include in analyses.
Risk assessment
For internal use only. Please select the risk level of this change:
Merge / deployment checklist