Skip to content
name: Salesforce Code Analyzer - on pull request
on:
pull_request:
branches:
- develop
jobs:
salesforce-code-analyzer-workflow:
runs-on: ubuntu-latest
steps:
- name: Check out files
uses: actions/checkout@v4
- name: Install Salesforce CLI
run: npm install -g @salesforce/cli@latest
- name: Install Salesforce Code Analyzer Plugin
run: sf plugins install @salesforce/sfdx-scanner@latest
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v44
- name: Run Salesforce Code Analyzer
id: run-code-analyzer
uses: forcedotcom/run-code-analyzer@v1
with:
run-command: run
run-arguments: --normalize-severity --target ${{ steps.changed-files.outputs.all_changed_files }} --outfile results.html
results-artifact-name: salesforce-code-analyzer-results
- name: Check the outputs to determine whether to fail
if: |
steps.run-code-analyzer.outputs.exit-code > 0 ||
steps.run-code-analyzer.outputs.num-sev1-violations > 0 ||
steps.run-code-analyzer.outputs.num-violations > 0
run: exit 1