EPMatt / reviewdog-action-prettier

Run Prettier with reviewdog :dog:

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Prettier ignores prettier_flags when using github-pr-review

paulvanbrenk opened this issue · comments

This is how I configured the action in my workflow file

      - uses: EPMatt/reviewdog-action-prettier@v1
        with:
          github_token: ${{ secrets.github_token }}
          reporter: github-pr-review # add comments in the review
          level: warning # [info,warning,error]
          prettier_flags: '**/*.{js,ts,tsx,md,json}'

However in the log from the github action I see the following:

image

And I get suggestions for changes in the yarn.lock file.

Any ideas?

edit: created a repo to show the issue. You can see the errors reported in the logs for the workflow for this PR

paulvanbrenk/prettier-action#1

Hi @paulvanbrenk,
thank you so much for reporting here.

This behavior is quite strange. Since we pass Prettier flags when the action is configured with github-pr-review as well, the filtering applied to prettier should have the same effect as with github-check.

This is the code for the github-pr-review reporter:

# if reporter is github-pr-review, run prettier in write mode and report code suggestions
if [ "$INPUT_REPORTER" = "github-pr-review" ]; then
"$(npm root)"/.bin/prettier --write "${INPUT_PRETTIER_FLAGS}" 2>&1 \

What happens if you run prettier locally with the same flags? eg. by executing the command from the package root directory: $(npm root)"/.bin/prettier --write **/*.{js,ts,tsx,md,json} ?

Thanks!

What happens if you run prettier locally with the same flags? eg. by executing the command from the package root directory: $(npm root)"/.bin/prettier --write **/*.{js,ts,tsx,md,json} ?

That works as expected.

It also looks like prettier is invoked twice when run with the github-pr-review reporter