@@ -202,29 +202,35 @@ impl Action {
202202 /// # Errors
203203 /// - If `working_directory()` fails
204204 /// - If path canonicalization fails
205- fn get_codeql_directories ( & self ) -> Result < Vec < PathBuf > > {
205+ fn get_codeql_directories ( & self ) -> Vec < PathBuf > {
206206 let mut paths = Vec :: new ( ) ;
207207
208208 // GITHUB_WORKSPACE
209209 if let Ok ( github_workspace) = std:: env:: var ( "GITHUB_WORKSPACE" ) {
210+ log:: debug!( "GITHUB_WORKSPACE found: {}" , github_workspace) ;
210211 paths. push ( PathBuf :: from ( github_workspace) . join ( ".codeql" ) ) ;
211212 }
212213
213214 // Local CodeQL directory in the working directory
214- if let Ok ( local_codeql) = self . working_directory ( ) ?. join ( ".codeql" ) . canonicalize ( ) {
215- paths. push ( local_codeql) ;
215+ if let Ok ( working_dir) = self . working_directory ( ) {
216+ if let Ok ( local_codeql) = working_dir. join ( ".codeql" ) . canonicalize ( ) {
217+ log:: debug!( "Local working directory found: {}" , local_codeql. display( ) ) ;
218+ paths. push ( local_codeql) ;
219+ }
216220 }
217221
218222 // Runner temp directory
219223 if let Ok ( runner_temp) = std:: env:: var ( "RUNNER_TEMP" ) {
220- paths. push ( PathBuf :: from ( runner_temp) . join ( ".codeql" ) . canonicalize ( ) ?) ;
224+ log:: debug!( "RUNNER_TEMP found: {}" , runner_temp) ;
225+ paths. push ( PathBuf :: from ( runner_temp) . join ( ".codeql" ) ) ;
221226 }
222227 // temp_dir
223228 if let Ok ( temp_dir) = std:: env:: temp_dir ( ) . canonicalize ( ) {
229+ log:: debug!( "System temp directory found: {}" , temp_dir. display( ) ) ;
224230 paths. push ( temp_dir. join ( ".codeql" ) ) ;
225231 }
226232
227- Ok ( paths)
233+ paths
228234 }
229235
230236 /// Returns the directory to use for CodeQL operations.
@@ -237,7 +243,10 @@ impl Action {
237243 /// It uses the parent of the working directory to to stop issues where the
238244 /// database/sarif files gets indexed by CodeQL.
239245 pub fn get_codeql_dir ( & self ) -> Result < PathBuf > {
240- let paths = self . get_codeql_directories ( ) ?;
246+ let paths = self . get_codeql_directories ( ) ;
247+ if paths. is_empty ( ) {
248+ return Err ( anyhow:: anyhow!( "No valid CodeQL directories were found" ) ) ;
249+ }
241250 log:: debug!( "Possible CodeQL directories: {:?}" , paths) ;
242251
243252 for path in paths {
0 commit comments