Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No errors and no review comments #222

Open
mscrivo opened this issue Sep 24, 2024 · 0 comments
Open

No errors and no review comments #222

mscrivo opened this issue Sep 24, 2024 · 0 comments

Comments

@mscrivo
Copy link

mscrivo commented Sep 24, 2024

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant