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

Action Run Failed. #54

Closed smunasingh closed 1 year ago

smunasingh commented 1 year ago

Hi, could you please let me know the reason for this issue I'm getting. Using mitchspano/sfdx-scan-pull-request@v0.1.11

npx sfdx scanner:run --pmdconfig ruleset.xml --target ".github/workflows/Static Analysis.yml,force-app/main/default/classes/UnusedInterface.cls" --json (node:1947) Warning: Deprecated config name: apiVersion. Please use org-api-version instead. (Use node --trace-warnings ... to show where the warning was created) node:internal/errors:841 const err = new Error(message); ^ Error: Command failed: npx sfdx scanner:run --pmdconfig ruleset.xml --target ".github/workflows/Static Analysis.yml,force-app/main/default/classes/UnusedInterface.cls" --json (node:1947) Warning: Deprecated config name: apiVersion. Please use org-api-version instead. (Use node --trace-warnings ... to show where the warning was created) at checkExecSyncError (node:child_process:828:11) at execSync (node:child_process:899:15) at /home/runner/work/_actions/mitchspano/sfdx-scan-pull-request/v0.1.11/dist/index.js:1:12423 at Generator.next () at /home/runner/work/_actions/mitchspano/sfdx-scan-pull-request/v0.1.11/dist/index.js:1:12142 at new Promise () at o (/home/runner/work/_actions/mitchspano/sfdx-scan-pull-request/v0.1.11/dist/index.js:1:11889) at cli (/home/runner/work/_actions/mitchspano/sfdx-scan-pull-request/v0.1.11/dist/index.js:1:12260) at /home/runner/work/_actions/mitchspano/sfdx-scan-pull-request/v0.1.11/dist/index.js:1:12670 { status: 1, signal: null, output: [ null, Buffer(1217) [Uint8Array] [ 123, 10, 32, 32, 34, 115, 116, 97, 116, 117, 115, 34, 58, 32, 49, 44, 10, 32, 32, 34, 110, 97, 109, 101, 34, 58, 32, 34, 83, 102, 69, 114, 114, 111, 114, 34, 44, 10, 32, 32, 34, 109, 101, 115, 115, 97, 103, 101, 34, 58, 32, 34, 84, 104, 101, 32, 80, 77, 68, 32, 99, 111, 110, 102, 105, 103, 32, 102, 105, 108, 101, 32, 114, 117, 108, 101, 115, 101, 116, 46, 120, 109, 108, 32, 99, 111, 117, 108, 100, 110, 39, 116, 32, 98, 101, 32, 102, 111, 117, 110, ... 1117 more items ], Buffer(165) [Uint8Array] [ 40, 110, 111, 100, 101, 58, 49, 57, 52, 55, 41, 32, 87, 97, 114, 110, 105, 110, 103, 58, 32, 68, 101, 112, 114, 101, 99, 97, 116, 101, 100, 32, 99, 111, 110, 102, 105, 103, 32, 110, 97, 109, 101, 58, 32, 97, 112, 105, 86, 101, 114, 115, 105, 111, 110, 46, 32, 80, 108, 101, 97, 115, 101, 32, 117, 115, 101, 32, 111, 114, 103, 45, 97, 112, 105, 45, 118, 101, 114, 115, 105, 111, 110, 32, 105, 110, 115, 116, 101, 97, 100, 46, 10, 40, 85, 115, 101, 32, 96, 110, ... 65 more items ] ], pid: 1934, stdout: Buffer(1217) [Uint8Array] [ 123, 10, 32, 32, 34, 115, 116, 97, 116, 117, 115, 34, 58, 32, 49, 44, 10, 32, 32, 34, 110, 97, 109, 101, 34, 58, 32, 34, 83, 102, 69, 114, 114, 111, 114, 34, 44, 10, 32, 32, 34, 109, 101, 115, 115, 97, 103, 101, 34, 58, 32, 34, 84, 104, 101, 32, 80, 77, 68, 32, 99, 111, 110, 102, 105, 103, 32, 102, 105, 108, 101, 32, 114, 117, 108, 101, 115, 101, 116, 46, 120, 109, 108, 32, 99, 111, 117, 108, 100, 110, 39, 116, 32, 98, 101, 32, 102, 111, 117, 110, ... 1117 more items ], stderr: Buffer(165) [Uint8Array] [ 40, 110, 111, 100, 101, 58, 49, 57, 52, 55, 41, 32, 87, 97, 114, 110, 105, 110, 103, 58, 32, 68, 101, 112, 114, 101, 99, 97, 116, 101, 100, 32, 99, 111, 110, 102, 105, 103, 32, 110, 97, 109, 101, 58, 32, 97, 112, 105, 86, 101, 114, 115, 105, 111, 110, 46, 32, 80, 108, 101, 97, 115, 101, 32, 117, 115, 101, 32, 111, 114, 103, 45, 97, 112, 105, 45, 118, 101, 114, 115, 105, 111, 110, 32, 105, 110, 115, 116, 101, 97, 100, 46, 10, 40, 85, 115, 101, 32, 96, 110, ... 65 more items ] }

mitchspano commented 1 year ago

Can you please share your entire YML file to help me determine the root cause of this?

mitchspano commented 1 year ago

Duplicate of #51

mitchspano commented 1 year ago

Dows your project have a ruleset.xml file? If not, you should omit the pmdconfig declaration:

 - name: Run SFDX Scanner - Report findings as comments
     uses: mitchspano/sfdx-scan-pull-request@v0.1.11
     with:
       pmdconfig: ruleset.xml #omit this line
       severity-threshold: 4
       strictly-enforced-rules: '[{ "engine": "pmd", "category": "Performance", "rule": "AvoidDebugStatements" }]'
     env:
       GITHUB_TOKEN: ${{ secrets.TOKEN }}
mitchspano commented 1 year ago

This was caused by an unnecessary reference to pmdconfig: ruleset.xml in the YML file.

I have improved the output of the scan when an error is encountered so if something goes wrong when calling the sfdx commands, you will be able to see the string representation of the error instead of the raw buffer.

I have also updated the README to have better instructions - explicitly calling out that the inputs to the scan are all optional.

smunasingh commented 1 year ago

Thank you @mitchspano