Skip to content

Conversation

@mbg
Copy link
Member

@mbg mbg commented Sep 19, 2025

This PR has two main contributions:

  1. We add general support for the new Repository Properties API.
  2. We use the Repository Properties API to allow configuring queries in a similar way that the queries input can be used.

For the Repository Properties support, we fetch the list of repository properties at the start of the init Action. 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. the Config type) 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:

  • Low risk: Changes are fully under feature flags, or have been fully tested and validated in pre-production environments and are highly observable, or are documentation or test only.

Merge / deployment checklist

  • Confirm this change is backwards compatible with existing workflows.
  • Consider adding a changelog entry for this change.
  • Confirm the readme and docs have been updated if necessary.

@mbg mbg changed the base branch from main to mbg/refactor/db-config-and-errors September 19, 2025 16:35
@mbg mbg force-pushed the mbg/add/properties-api branch from b8fc51c to 8cba882 Compare September 20, 2025 12:02
@mbg mbg force-pushed the mbg/add/properties-api branch from 8cba882 to c7eb488 Compare September 20, 2025 13:09
@mbg mbg force-pushed the mbg/refactor/db-config-and-errors branch from 96ca55b to a067418 Compare September 20, 2025 13:10
Base automatically changed from mbg/refactor/db-config-and-errors to main September 22, 2025 11:23
@mbg mbg marked this pull request as ready for review September 22, 2025 12:09
@mbg mbg requested a review from a team as a code owner September 22, 2025 12:09
@mbg mbg requested review from Copilot and henrymercer September 22, 2025 12:09
Copy link
Contributor

Copilot AI left a 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

Copy link
Contributor

@henrymercer henrymercer left a 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.

@mbg mbg force-pushed the mbg/add/properties-api branch from 840c9ad to 05310c6 Compare September 22, 2025 15:32
@mbg mbg requested a review from henrymercer September 22, 2025 15:34
henrymercer
henrymercer previously approved these changes Sep 23, 2025
Copy link
Contributor

@henrymercer henrymercer left a 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.

henrymercer
henrymercer previously approved these changes Sep 23, 2025
@mbg mbg enabled auto-merge September 23, 2025 08:53
@mbg mbg merged commit 665891b into main Sep 23, 2025
390 of 470 checks passed
@mbg mbg deleted the mbg/add/properties-api branch September 23, 2025 09:17
@github-actions github-actions bot mentioned this pull request Sep 25, 2025
8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants