File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -179,16 +179,24 @@ impl Action {
179179
180180 /// Returns the directory to use for CodeQL operations.
181181 ///
182- /// # Errors
182+ /// Gets the CodeQL directory to use for the action. It will first check if a local
183+ /// `.codeql` directory exists in the working directory parent. If not, it will
184+ /// use the `RUNNER_TEMP` directory. If neither exists, it will create a new
185+ /// `.codeql` directory in the working directory parent.
183186 ///
184- /// Returns an error if the directory cannot be created.
187+ /// It uses the parent of the working directory to to stop issues where the
188+ /// database/sarif files gets indexed by CodeQL.
185189 pub fn get_codeql_dir ( & self ) -> Result < PathBuf > {
186190 let paths = vec ! [
187- // Local CodeQL directory in the working directory
188- self . working_directory( ) ?. join( ".codeql" ) ,
191+ // Local CodeQL directory in the working directory parent
192+ self . working_directory( ) ?
193+ . join( ".." )
194+ . join( ".codeql" )
195+ . canonicalize( ) ?,
189196 // Runner temp directory
190197 PathBuf :: from( std:: env:: var( "RUNNER_TEMP" ) . unwrap_or_else( |_| "/tmp" . to_string( ) ) )
191- . join( ".codeql" ) ,
198+ . join( ".codeql" )
199+ . canonicalize( ) ?,
192200 ] ;
193201
194202 for path in paths {
You can’t perform that action at this time.
0 commit comments