pragmatic-bear / sfdx-code-review-action

GitHub Pull Request code review using Salesforce Code Analyzer
MIT License
9 stars 6 forks source link

eslint-lwc not working. #10

Open neozhu opened 8 months ago

neozhu commented 8 months ago

name: Code Review
on:
  # The workflow will run whenever an event happens on a pull request
  pull_request:
    # The events are that a PR is opened, or when a commit is pushed
    # to a branch that has an existing pull request
    types: [opened, synchronize, reopened, push]
    # The branches filter allows to specify that this workflow should only
    # run if the branch name is "UAT". This way we prevent this workflow
    # from running when PRs are opened on other branches
    branches:
      - UAT
    # We only care about changes to the force-app directory, which is the
    # root directory of the sfdx project. This prevents the job from running
    # when changing non-salesforce files (like this yml file).
    paths:
      - "force-app/**"
jobs:
    review:
        name: Review Apex Code
        runs-on: 'ubuntu-latest'
        steps:
            - name: Code Review
              uses: pragmatic-bear/sfdx-code-review-action@v0.5.2
              with:
                  source_path: 'force-app/main/**/*'
                  reject_threshold: 1
                  severity_threshold: 3
                  # approve_threshold: 3
                  # category: 'Documentation,'
                  pmdconfig: '.github/workflows/pmd-ruleset.xml'
                  engine: 'pmd, eslint-lwc'
                  github_token: ${{ secrets.GIT_TOKEN }}
Run sfdx scanner:run --target "$DIFF_LIST" --category "" --engine "pmd, eslint-lwc" --eslintconfig "" --pmdconfig ".github/workflows/pmd-ruleset.xml" --tsconfig "" --format csv --normalize-severity  > report.csv

and action.yml

    - name: Install Salesforce CLI
      shell: bash
      run: |
          wget https://developer.salesforce.com/media/salesforce-cli/sfdx/channels/stable/sfdx-linux-x64.tar.xz
          mkdir ~/sfdx
          tar xJf sfdx-linux-x64.tar.xz -C ~/sfdx --strip-components 1
          echo "$HOME/sfdx/bin" >> $GITHUB_PATH
          ~/sfdx/bin/sfdx version

I recommend replacing the above code with the npm library

    - name: 'Install Salesforce CLI'
       run: npm install -g @salesforce/cli@latest

Please take a look at it.

packocz commented 7 months ago

Hi @neozhu can you elaborate on what's not working exactly, please? I'm trying this out and the review seems to work fine for me with the same settings. Yea it's probably worth updating the action in general (will do soon), but I don't see an issue right now.