@@ -12,6 +12,7 @@ import * as reporter from './reporter';
1212
1313async function getData (
1414 ignore : string [ ] | undefined ,
15+ workingDirectory : string ,
1516) : Promise < interfaces . Report > {
1617 const cargo = await Cargo . get ( ) ;
1718 await cargo . findOrInstall ( 'cargo-audit' ) ;
@@ -24,6 +25,7 @@ async function getData(
2425 commandArray . push ( '--ignore' , item ) ;
2526 }
2627 commandArray . push ( '--json' ) ;
28+ commandArray . push ( '--file' , `${ workingDirectory } /Cargo.lock` ) ;
2729 await cargo . call ( commandArray , {
2830 ignoreReturnCode : true ,
2931 listeners : {
@@ -44,9 +46,17 @@ async function getData(
4446 return JSON . parse ( stdout ) ;
4547}
4648
49+ function removeTrailingSlash ( str ) {
50+ if ( str [ str . length - 1 ] === '/' ) {
51+ return str . substr ( 0 , str . length - 1 ) ;
52+ }
53+ return str ;
54+ }
55+
4756export async function run ( actionInput : input . Input ) : Promise < void > {
4857 const ignore = actionInput . ignore ;
49- const report = await getData ( ignore ) ;
58+ const workingDirectory = removeTrailingSlash ( actionInput . workingDirectory ) ;
59+ const report = await getData ( ignore , workingDirectory ) ;
5060 let shouldReport = false ;
5161 if ( ! report . vulnerabilities . found ) {
5262 core . info ( 'No vulnerabilities were found' ) ;
0 commit comments