File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed
Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -282,7 +282,18 @@ async fn main() -> Result<()> {
282282 groupend ! ( ) ;
283283 }
284284
285- action. set_sarif_results ( sarif_output. display ( ) . to_string ( ) ) ;
285+ // If the action is running in Actions, the SARIF file must be a relative path
286+ // This is because we assume that this code is running in a container which mounts
287+ // the repository at /github/workspace
288+ if let Ok ( _) = std:: env:: var ( "CI" ) {
289+ // If running in a CI environment, set the SARIF as a relative path
290+ let relative_path = sarif_output. strip_prefix ( & cwd) . unwrap_or ( & sarif_output) ;
291+ log:: debug!( "CI environment detected, setting SARIF path as relative: {}" , relative_path. display( ) ) ;
292+ action. set_sarif_results ( relative_path. display ( ) . to_string ( ) ) ;
293+ } else {
294+ log:: debug!( "Setting SARIF path as absolute: {}" , sarif_output. display( ) ) ;
295+ action. set_sarif_results ( sarif_output. display ( ) . to_string ( ) ) ;
296+ }
286297
287298 log:: info!( "All databases created and analyzed" ) ;
288299
You can’t perform that action at this time.
0 commit comments