Content-Length: 381291 | pFad | http://github.com/github/codeql-action/pull/2972

E8 Ignore pre-release parts when comparing GHES versions by koesie10 · Pull Request #2972 · github/codeql-action · GitHub
Skip to content

Ignore pre-release parts when comparing GHES versions #2972

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 1 commit into from
Jul 17, 2025

Conversation

koesie10
Copy link
Member

This will change our GHES version comparison to always compare without taking into consideration the pre-release part of the version, and dropping any unrecognized semver parts.

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.

@koesie10 koesie10 marked this pull request as ready for review July 15, 2025 09:16
@Copilot Copilot AI review requested due to automatic review settings July 15, 2025 09:16
@koesie10 koesie10 requested a review from a team as a code owner July 15, 2025 09:16
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 refactors the GHES version comparison logic to ignore pre-release version parts when determining compatibility. The change replaces the parseGhesVersion function with a new satisfiesGHESVersion function that uses semver.coerce and explicitly strips pre-release components before performing version comparisons.

  • Replace parseGhesVersion function with satisfiesGHESVersion for cleaner version range checking
  • Use semver.coerce to handle non-standard version formats and strip pre-release components
  • Update all GHES version comparisons to use the new function with range syntax

Reviewed Changes

Copilot reviewed 4 out of 6 changed files in this pull request and generated 1 comment.

File Description
src/util.ts Replaces parseGhesVersion with satisfiesGHESVersion function that strips pre-release parts
src/upload-lib.ts Updates version comparisons to use new function and removes unused semver import
lib/util.js Generated JavaScript for the util.ts changes
lib/upload-lib.js Generated JavaScript for the upload-lib.ts changes

Copy link
Member

@mbg mbg left a comment

Choose a reason for hiding this comment

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

Thanks for putting this together! This probably makes sense, since I can't imagine that we'd want to check for a particular pre-release version. Dropping the pre-release for the comparison makes sense to me.

One suggestion about the potential footgun that Copilot highlighted as well.

mbg
mbg previously approved these changes Jul 16, 2025
Copy link
Member

@mbg mbg left a comment

Choose a reason for hiding this comment

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

Thanks! This looks good now.

@@ -1141,15 +1141,11 @@ export function checkActionVersion(
* is invalid, this will return `defaultIfInvalid`.
*/
export function satisfiesGHESVersion(
githubVersion: GitHubVersion,
ghesVersion: string,
Copy link
Member

Choose a reason for hiding this comment

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

Good idea!

@mbg
Copy link
Member

mbg commented Jul 16, 2025

There's a merge conflict with lib/upload-lib.js.map which I think you can resolve by merging / rebasing and then running npm run build again

@koesie10
Copy link
Member Author

Thanks for the reviews! I've rebased and squashed all three commits into one to make this easier to cherry-pick for the backport.

@koesie10 koesie10 merged commit 07455ed into main Jul 17, 2025
282 checks passed
@koesie10 koesie10 deleted the koesie10/ghes-satisfies branch July 17, 2025 08:35
@mbg mbg mentioned this pull request Jul 17, 2025
3 tasks
@github-actions github-actions bot mentioned this pull request Jul 21, 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








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/github/codeql-action/pull/2972

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy