mitchspano / sfdx-scan-pull-request

Runs sfdx-scanner on a pull request and generates in-line comments with the findings.
Apache License 2.0
73 stars 25 forks source link

Add support for locally installed sfdx plugin to speed up scanner step #65

Open leojok-fluido opened 1 year ago

leojok-fluido commented 1 year ago

My project installs all dependent sfdx and sfdx plugins first using yarn install --frozen-lockfile and then GHA will create cache from node_modules allowing faster pipelines to be built. package.json has defined "@salesforce/sfdx-scanner": "3.15.0"

Maybe code should set SFDX_DATA_DIR prior calling npx sfdx scanner:run so that it would not install plugin again?

SFDX_DATA_DIR="$(pwd)" npx sfdx scanner:run --pmdconfig config/pmd-rules.xml --target "force-app/main/default/classes/*.cls" --json

Logs:

Run mitchspano/sfdx-scan-pull-request@v0.1.15
Beginning sfdx-scan-pull-request run...
Validating that this action was invoked from an acceptable context...
Performing static code analysis on all of the relevant files...
npx sfdx scanner:run --pmdconfig config/pmd-rules.xml --target "force-app/main/default/classes/*.cls" --json
You acknowledge and agree that the CLI tool may collect usage information, user environment, and crash reports for the purposes of providing services or functions that are relevant to use of the CLI tool and product improvements.

Installing plugin @salesforce/sfdx-scanner...
Installing plugin @salesforce/sfdx-scanner...