Skip to content

No errors and no review comments #222

@mscrivo

Description

@mscrivo

Hi, I'm struggling a bit to get this working on changed files only (to keep it fast). My action looks like this:

name: reviewdog
on: [pull_request]
jobs:
  reviewdog:
    name: runner
    runs-on: ubuntu-latest
    permissions:
      contents: read
      pull-requests: write
    steps:
      - uses: actions/checkout@v4
      - uses: pnpm/action-setup@v4
        with:
          version: 9
          run_install: false

      - name: Install Node.js
        uses: actions/setup-node@v4
        with:
          node-version: 20
          cache: 'pnpm'
      - name: Install dependencies
        run: pnpm install

      - id: files
        uses: Ana06/[email protected]
      - name: Get changed JS files
        run: |
          matching_files=()
          for changed_file in ${{ steps.files.outputs.added_modified }}; do
            if [[ "$changed_file" =~ \.(js|jsx|ts|tsx)$ ]]; then
              matching_files+=("$changed_file")
            fi
          done
          # Set env var to be used in next step
          echo "CHANGED_JS_FILES=${matching_files[@]}" >> $GITHUB_ENV
      - run: |
          # If I run this line, it does show the eslint errors I expect
          # npx --no-install -c "eslint ${{ env.CHANGED_JS_FILES }}"
      - uses: reviewdog/action-eslint@v1
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
          reporter: github-pr-review
          level: error
          eslint_flags: "${{ env.CHANGED_JS_FILES }}"

As mentioned in the code above, if I uncomment the step that does: npx --no-install -c "eslint ${{ env.CHANGED_JS_FILES }}" it correctly shows eslint errors in stdout, but when running through the next step, it provides no output, no errors and there are no review comments.

I know it's not a permissions issue, since I have another action for reviewdog-shellcheck using the same token, and that one works perfectly fine.

Any clue what I'm doing wrong here?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions