mirror of
https://github.com/github/codeql-action.git
synced 2026-01-02 04:30:14 +08:00
Stop using feature-flag support for determining if a feature is active
Using the feature flag mechanism for checking if uploads are enabled was too clunky. I'm moving the change to checking versions directly.
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import * as semver from "semver";
|
||||
|
||||
import type { VersionInfo } from "./codeql";
|
||||
|
||||
export enum ToolsFeature {
|
||||
@@ -26,3 +28,21 @@ export function isSupportedToolsFeature(
|
||||
): boolean {
|
||||
return !!versionInfo.features && versionInfo.features[feature];
|
||||
}
|
||||
|
||||
export const SafeArtifactUploadVersion = "2.20.3";
|
||||
|
||||
/**
|
||||
* The first version of the CodeQL CLI where artifact upload is safe to use
|
||||
* for failed runs. This is not really a feature flag, but it is easiest to
|
||||
* model the behavior as a feature flag.
|
||||
*
|
||||
* This was not captured in a tools feature, so we need to use semver.
|
||||
*
|
||||
* @param codeQlVersion The version of the CodeQL CLI to check. If not provided, it is assumed to be safe.
|
||||
* @returns True if artifact upload is safe to use for failed runs or false otherwise.
|
||||
*/
|
||||
export function isSafeArtifactUpload(codeQlVersion?: string): boolean {
|
||||
return !codeQlVersion
|
||||
? true
|
||||
: semver.gte(codeQlVersion, SafeArtifactUploadVersion);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user