@@ -47,7 +47,16 @@ const GENERIC_404_MSG =
4747// Checks whether the deprecation warning for combining SARIF files should be shown.
4848export async function shouldShowCombineSarifFilesDeprecationWarning (
4949 sarifObjects : Array < Partial < sarif . Log > > ,
50+ githubVersion : GitHubVersion ,
5051) {
52+ // Do not show this warning on GHES versions before 3.14.0
53+ if (
54+ githubVersion . type === GitHubVariant . GHES &&
55+ satisfiesGHESVersion ( githubVersion . version , "<3.14" , true )
56+ ) {
57+ return false ;
58+ }
59+
5160 // Only give a deprecation warning when not all runs are unique and
5261 // we haven't already shown the warning.
5362 return (
@@ -122,7 +131,12 @@ async function combineSarifFilesUsingCLI(
122131 "Not all SARIF files were produced by CodeQL. Merging files in the action." ,
123132 ) ;
124133
125- if ( await shouldShowCombineSarifFilesDeprecationWarning ( sarifObjects ) ) {
134+ if (
135+ await shouldShowCombineSarifFilesDeprecationWarning (
136+ sarifObjects ,
137+ gitHubVersion ,
138+ )
139+ ) {
126140 logger . warning (
127141 `Uploading multiple SARIF runs with the same category is deprecated ${ deprecationWarningMessage } . Please update your workflow to upload a single run per category. ${ deprecationMoreInformationMessage } ` ,
128142 ) ;
@@ -883,12 +897,6 @@ export async function waitForProcessing(
883897 ) ;
884898 break ;
885899 }
886- if ( ! response ) {
887- logger . warning (
888- "Unable to check analysis status due to missing response. It should still be processed in the background." ,
889- ) ;
890- break ;
891- }
892900 const status = response . data . processing_status as ProcessingStatus ;
893901 logger . info ( `Analysis upload status is ${ status } .` ) ;
894902
@@ -1045,7 +1053,7 @@ function sanitize(str?: string) {
10451053 return ( str ?? "_" ) . replace ( / [ ^ a - z A - Z 0 - 9 _ ] / g, "_" ) . toLocaleUpperCase ( ) ;
10461054}
10471055
1048- export function filterAlertsByDiffRange (
1056+ function filterAlertsByDiffRange (
10491057 logger : Logger ,
10501058 sarifLog : Partial < sarif . Log > ,
10511059) : Partial < sarif . Log > {
@@ -1058,6 +1066,8 @@ export function filterAlertsByDiffRange(
10581066 return sarifLog ;
10591067 }
10601068
1069+ const checkoutPath = actionsUtil . getRequiredInput ( "checkout_path" ) ;
1070+
10611071 for ( const run of sarifLog . runs ) {
10621072 if ( run . results ) {
10631073 run . results = run . results . filter ( ( result ) => {
@@ -1072,14 +1082,19 @@ export function filterAlertsByDiffRange(
10721082 if ( ! locationUri || locationStartLine === undefined ) {
10731083 return false ;
10741084 }
1085+ // CodeQL always uses forward slashes as the path separator, so on Windows we
1086+ // need to replace any backslashes with forward slashes.
1087+ const locationPath = path
1088+ . join ( checkoutPath , locationUri )
1089+ . replaceAll ( path . sep , "/" ) ;
10751090 // Alert filtering here replicates the same behavior as the restrictAlertsTo
10761091 // extensible predicate in CodeQL. See the restrictAlertsTo documentation
10771092 // https://codeql.github.com/codeql-standard-libraries/csharp/codeql/util/AlertFiltering.qll/predicate.AlertFiltering$restrictAlertsTo.3.html
10781093 // for more details, such as why the filtering applies only to the first line
10791094 // of an alert location.
10801095 return diffRanges . some (
10811096 ( range ) =>
1082- range . path === locationUri &&
1097+ range . path === locationPath &&
10831098 ( ( range . startLine <= locationStartLine &&
10841099 range . endLine >= locationStartLine ) ||
10851100 ( range . startLine === 0 && range . endLine === 0 ) ) ,
0 commit comments