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

Scan crashes when there are no files moved into `temporary` folder #5

Closed mitchspano closed 2 years ago

mitchspano commented 2 years ago

If the scope of the pull request does not generate any files to be moved into the temporary folder, the scan crashes.

This can happen if the PR only contains modifications to the .github folder, and potentially other scenarios as well.

The system should gracefully exit if there is nothing in temporary.

Getting difference since Last commit...
Recursively moving all files to the temp folder...
(node:1[8](https://github.com/rsoesemann/salesforce-recipes/runs/7617039009?check_suite_focus=true#step:4:9)31) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
Performing static code analysis on all of the files in the difference...
WARNING: We're constantly improving Salesforce Code Analyzer. Tell us what you think! Give feedback at https://research.net/r/SalesforceCA.
WARNING: In September 2022, v3.x of the Salesforce Code Analyzer will become the default version,
         and older versions, including your currently installed version, will no longer be supported.
         You can manually update to v3.x earlier for a smoother transition.
WARNING: As of April 27, 2022, v3.x of the Salesforce Code Analyzer is available as an open pilot.
         To update to v3.x and try out our pilot features, run these commands:
         > sfdx plugins:uninstall @salesforce/sfdx-scanner
         > sfdx plugins:install @salesforce/sfdx-scanner@latest-pilot
WARNING: Target: 'temporary' was not processed by any engines.
node:fs:585
  handleErrorFromBinding(ctx);
  ^

Error: ENOENT: no such file or directory, open '/home/runner/work/salesforce-recipes/salesforce-recipes/sfdx-scanner-findings.json'
    at Object.openSync (node:fs:585:3)
    at Object.readFileSync (node:fs:453:35)
    at performStaticCodeAnalysisOnFilesInDiff (/home/runner/work/_actions/mitchspano/sfdx-scan-pull-request/v0.1/dist/index.js:7[15](https://github.com/rsoesemann/salesforce-recipes/runs/7617039009?check_suite_focus=true#step:4:16)64:33)
    at main (/home/runner/work/_actions/mitchspano/sfdx-scan-pull-request/v0.1/dist/index.js:717[16](https://github.com/rsoesemann/salesforce-recipes/runs/7617039009?check_suite_focus=true#step:4:17):3) {
  errno: -2,
  syscall: 'open',
  code: 'ENOENT',
  path: '/home/runner/work/salesforce-recipes/salesforce-recipes/sfdx-scanner-findings.json'
}