Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Do not fail diff informed analyses when analyze is run twice in the same job #2876

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

Merged
merged 4 commits into from
May 1, 2025

Conversation

henrymercer
Copy link
Contributor

@henrymercer henrymercer commented May 1, 2025

Tolerate the diff range extension pack directory already existing and overwrite it, to avoid failing in jobs that call analyze more than once.

Also defer the computation of the dependency caching default cache config to avoid getting the value of the RUNNER_TEMP environment variable before it can be overridden by test logic.

And finally disable diff-informed analyses within the config parsing tests, since these tests do not account for the additional query filter added by diff-informed analyses.

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.

These relied on the RUNNER_TEMP environment variable that does not necessarily exist when running locally.
@Copilot Copilot AI review requested due to automatic review settings May 1, 2025 11:04
@henrymercer henrymercer requested a review from a team as a code owner May 1, 2025 11:04
Copy link
Contributor

@Copilot 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 ensures that running the analyze action multiple times in the same job does not fail by:

  • Changing the default cache config from a static constant to a lazily computed function
  • Making the diff-range extension pack directory creation idempotent with recursive: true

Reviewed Changes

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

File Description
src/dependency-caching.ts Replaced static CODEQL_DEFAULT_CACHE_CONFIG with getDefaultCacheConfig() to defer env‑based values
src/analyze.ts Made fs.mkdirSync recursive when creating the diff-range dir
lib/dependency-caching.js Mirrored the switch to getDefaultCacheConfig() in compiled JS
lib/analyze.js Mirrored use of fs.mkdirSync(..., { recursive: true }) in JS

Copy link
Contributor

@nickrolfe nickrolfe left a comment

Choose a reason for hiding this comment

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

Looks sensible.

@henrymercer henrymercer merged commit 81a9508 into main May 1, 2025
270 checks passed
@henrymercer henrymercer deleted the henrymercer/fix-diff-informed-multiple-analyze branch May 1, 2025 12:08
@github-actions github-actions bot mentioned this pull request May 2, 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.

2 participants