FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

getFileDiffsWithBasehead(): use CODE_SCANNING_REPOSITORY if present by cklin · Pull Request #2830 · github/codeql-action · GitHub

getFileDiffsWithBasehead(): use CODE_SCANNING_REPOSITORY if present - #2830

Merged
cklin merged 4 commits into
mainfrom
cklin/code-scanning-repo
Mar 27, 2025
Merged

cklin merged 4 commits into
mainfrom
cklin/code-scanning-repo

Conversation

cklin commented Mar 26, 2025
edited
Loading

Copy link
Copy Markdown
Contributor

This PR updates getFileDiffsWithBasehead() so that it uses CODE_SCANNING_REPOSITORY if present, which makes it possible to override the repository that contains the commits being analized.

The PR also introduces a getRepositoryNwo() helper function that reduces code duplication across the codebase.

Merge / deployment checklist

  • Confirm this change is backwards compatible with existing workflows.
  • Confirm the readme has been updated if necessary.
  • Confirm the changelog has been updated if necessary.

cklin marked this pull request as ready for review March 26, 2025 17:58
Copilot AI review requested due to automatic review settings March 26, 2025 17:58
cklin requested a review from a team as a code owner March 26, 2025 17:58

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Pull Request Overview

This PR updates the repository name resolution in various modules to allow an override via the CODE_SCANNING_REPOSITORY environment variable, making the functions more flexible in determining the repository context for code scanning operations.

  • Replace all usages of parseRepositoryNwo with getRepositoryNwo (or getRepositoryNwoFromEnv) to support the new override.
  • Update functions across core modules (src, lib folders) to use the new repository resolution functions.

Reviewed Changes

Copilot reviewed 33 out of 33 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/status-report.ts Updated repository info retrieval using getRepositoryNwo
src/repository.ts Introduced getRepositoryNwo and getRepositoryNwoFromEnv functions
src/init-action*.ts Replaced parseRepositoryNwo with getRepositoryNwo
src/autobuild.ts Similar repository resolution update
src/api-client.ts Updated repository usage in API requests
src/analyze*.ts Updated getFileDiffsWithBasehead to consider CODE_SCANNING_REPOSITORY
lib/* Consistent update of repository function calls throughout
Comments suppressed due to low confidence (1)

src/analyze.ts:393

  • It appears there is no test coverage for the conditional logic in getRepositoryNwoFromEnv (i.e. when CODE_SCANNING_REPOSITORY is set versus when it is not). Consider adding tests to ensure both scenarios are properly handled.
const repositoryNwo = getRepositoryNwoFromEnv("CODE_SCANNING_REPOSITORY", "GITHUB_REPOSITORY");

Tip: Copilot only keeps its highest confidence comments to reduce noise and keep you focused. Learn more

angelapwen previously approved these changes Mar 27, 2025

angelapwen left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Makes sense!! Just a small comment about documentation 😸

Comment thread src/analyze.ts
): Promise<FileDiff[] | undefined> {
const repositoryNwo = getRepositoryNwo();
const repositoryNwo = getRepositoryNwoFromEnv(
"CODE_SCANNING_REPOSITORY",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Perhaps a small code comment here indicating that CODE_SCANNING_REPOSITORY is intended to override GITHUB_REPOSITORY would be useful for other maintainers!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Thanks for the suggestion! I added the comment.

cklin merged commit 9bd18b4 into main Mar 27, 2025
cklin deleted the cklin/code-scanning-repo branch March 27, 2025 17:25
github-actions Bot mentioned this pull request Apr 7, 2025
8 tasks
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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants


Back | FazBrowse Home | New Git URL