Add repository property for configuration files#3963
Open
mbg wants to merge 5 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Warning
- Copilot's review of this pull request may be incomplete because some of the changed files are excluded by your Copilot content exclusion settings. See Excluding content from Copilot for details.
Pull request overview
This PR introduces a new repository property (github-codeql-config-file) that can provide the CodeQL configuration file location when no explicit config-file workflow input is set, with the workflow input taking precedence. It wires this selection into the init action and adds unit tests around property loading and the selection logic.
Changes:
- Add
RepositoryPropertyName.CONFIG_FILEand parse it from the repository properties API response. - Add
getConfigFileInput()to resolve the effective config file location (workflow input first, otherwise repository property) and use it frominit-action. - Add small test utilities and unit tests for both repository property parsing and config file resolution.
Show a summary per file
| File | Description |
|---|---|
| src/actions-util.ts | Adds an ActionsEnv abstraction and getActionsEnv() to avoid stubbing globals in tests. |
| src/init-action.ts | Uses repository properties + getConfigFileInput() to determine configFile instead of reading the input directly. |
| src/feature-flags/properties.ts | Adds the new github-codeql-config-file repository property to the known/parsed property set. |
| src/feature-flags/properties.test.ts | Extends coverage to ensure the new property is loaded and returned from the API response. |
| src/config/file.ts | New helper for resolving the effective config file from workflow input vs repository property. |
| src/config/file.test.ts | Adds unit tests validating precedence and logging for config file resolution. |
| src/testing-utils.ts | Adds a helper to construct an ActionsEnv for tests. |
| lib/entry-points.js | Excluded from diff (generated/contents unavailable per policy). |
Copilot's findings
Files excluded by content exclusion policy (1)
- lib/entry-points.js
- Files reviewed: 7/8 changed files
- Comments generated: 4
Comment on lines
+23
to
+31
| const propertyValue = | ||
| repositoryProperties[RepositoryPropertyName.CONFIG_FILE]; | ||
|
|
||
| if (propertyValue !== undefined) { | ||
| logger.info( | ||
| `Using configuration file input from repository property: ${propertyValue}`, | ||
| ); | ||
| return propertyValue; | ||
| } |
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.
This PR is the first in a series of changes which will add the ability to point the CodeQL Action at a configuration file using a repository property.
This PR adds the new repository property and uses its value, if provided and no explicit
config-fileinput is provided for the CodeQL Action in the workflow. In other words, theconfig-fileinput has priority over the value of the repository property.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).If something goes wrong after this change is released, what are the mitigation and rollback strategies?
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