This PR moves the sfca-analysis job from the SFCA action to the Salesforce Code Analyzer CLI, and the job now reads the Code Analyzer's JSON report instead of SARIF. A new composite action, sf-code-analyzer-report, writes the violation counts and Markdown tables to the job summary, and the job fails when a priority 1 or 2 violation is found.
Changes
BEGIN_NESTED_COMMIT
ci(workflows): run the Code Analyzer CLI and write results to sfca
The sfca-analysis job runs sf code-analyzer run with the Recommended and Custom rules and writes its reports to sfca/. The report step reads sfca/sfca_results.json, and it runs even when the scan fails. The upload step uploads the sfca folder under the artifact name sfca-report, and it also runs even when the scan fails. The job drops the Python setup and the pull-requests permission, which the old SFCA action needed.
END_NESTED_COMMIT
BEGIN_NESTED_COMMIT
feat(ci): add a job summary report for Code Analyzer results
The new sf-code-analyzer-report composite action reads sfca_results.json, writes the violation counts and Markdown tables to the job summary, and exposes the counts and tables as outputs. Each violation links to its line at the commit that ran. An empty severity-cutoff puts every violation in one table.
END_NESTED_COMMIT
BEGIN_NESTED_COMMIT
refactor(ci): read Code Analyzer results from JSON, not SARIF
The new parse-sfca-results composite action counts the JSON report by severity and writes a Markdown table sorted by file and then by line. It replaces pmd-sarif-priorities, which read PMD's SARIF output and is removed. CI does not call parse-sfca-results in this PR.
END_NESTED_COMMIT
BEGIN_NESTED_COMMIT
chore(code-analyzer): remove machine paths from the config on commit
The pre-commit hook deletes the # Last calculated by the config command as: comments from code-analyzer.yml, which record paths from one author's machine. The hook uses perl, which runs on Linux as well as macOS. The ignores list skips docs/, doc-assets/, and sfca* files, and package.json gains a codeanalyzer:run script.
END_NESTED_COMMIT
BEGIN_NESTED_COMMIT
chore(git): ignore the Code Analyzer report folder
Git and Prettier ignore sfca/, so the generated reports stay out of commits and out of the format check.
END_NESTED_COMMIT
Behavior notes
The Code Analyzer scans the whole workspace on every pull request. The SFCA action scanned only the changed files, so runs take longer, and the report includes violations that this PR did not add.
The report step sets severity-cutoff to 2, so priority 1 and 2 violations appear in the first table and fail the job. The run also writes sfca/sfca-report.sarif, which nothing reads. The Code Analyzer's exit status when it finds violations is not yet confirmed, so the first run will show whether the scan step fails before the gate runs.
Test plan
Locally, the shell steps of sf-code-analyzer-report were run against a saved sfca_results.json. They gave 24 violations, the expected tables, and the same counts as the report, with an empty cutoff and with a cutoff of 2. The workflow itself has not run on GitHub yet. Open the pull request and confirm that the sfca-analysis job runs the Code Analyzer, writes both tables to the job summary, and fails only when a priority 1 or 2 violation is present. Confirm that the sfca-report artifact contains the sfca folder with the JSON and HTML reports. The actions/upload-artifact@v7 and actions/setup-java@v5 tags have not been checked against a run.
🤖 Generated with Claude Code