{"id":15464483,"url":"https://github.com/epmatt/reviewdog-action-prettier","last_synced_at":"2025-09-05T19:32:49.860Z","repository":{"id":37795445,"uuid":"464823657","full_name":"EPMatt/reviewdog-action-prettier","owner":"EPMatt","description":"Run Prettier with reviewdog :dog:","archived":false,"fork":false,"pushed_at":"2024-09-16T14:29:59.000Z","size":57,"stargazers_count":23,"open_issues_count":14,"forks_count":10,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-10-29T22:47:53.158Z","etag":null,"topics":["action","actions","ci","cicd","code","code-formatter","code-review","continuous-integration","formatter","formatters","github","github-actions","prettier","reviewdog","reviewdog-action","testing","web"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/EPMatt.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"custom":"https://www.buymeacoffee.com/epmatt"}},"created_at":"2022-03-01T09:20:21.000Z","updated_at":"2024-08-28T08:07:48.000Z","dependencies_parsed_at":"2023-12-19T17:16:08.704Z","dependency_job_id":"6c2498a0-d9da-4718-8ab5-c2505bbcd829","html_url":"https://github.com/EPMatt/reviewdog-action-prettier","commit_stats":{"total_commits":44,"total_committers":5,"mean_commits":8.8,"dds":0.5454545454545454,"last_synced_commit":"ea9650ff37c6cbb85d3d101ecd1c5215e7ba1b95"},"previous_names":[],"tags_count":11,"template":false,"template_full_name":"reviewdog/action-composite-template","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EPMatt%2Freviewdog-action-prettier","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EPMatt%2Freviewdog-action-prettier/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EPMatt%2Freviewdog-action-prettier/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EPMatt%2Freviewdog-action-prettier/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/EPMatt","download_url":"https://codeload.github.com/EPMatt/reviewdog-action-prettier/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":232056125,"owners_count":18466284,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["action","actions","ci","cicd","code","code-formatter","code-review","continuous-integration","formatter","formatters","github","github-actions","prettier","reviewdog","reviewdog-action","testing","web"],"created_at":"2024-10-02T00:37:34.874Z","updated_at":"2025-01-01T07:19:01.537Z","avatar_url":"https://github.com/EPMatt.png","language":"Shell","funding_links":["https://www.buymeacoffee.com/epmatt","https://www.buymeacoffee.com/epmatt)*"],"categories":[],"sub_categories":[],"readme":"# reviewdog-action-prettier\n\n![Maintained](https://img.shields.io/badge/maintained-yes-brightgreen) \n[![Tests](https://github.com/EPMatt/reviewdog-action-prettier/actions/workflows/test.yml/badge.svg)](https://github.com/EPMatt/reviewdog-action-prettier/actions/workflows/test.yml)\n[![Code Quality](https://github.com/EPMatt/reviewdog-action-prettier/actions/workflows/reviewdog.yml/badge.svg)](https://github.com/EPMatt/reviewdog-action-prettier/actions/workflows/reviewdog.yml)\n[![Deps auto update](https://github.com/EPMatt/reviewdog-action-prettier/actions/workflows/depup.yml/badge.svg)](https://github.com/EPMatt/reviewdog-action-prettier/actions/workflows/depup.yml)\n[![Release](https://github.com/EPMatt/reviewdog-action-prettier/actions/workflows/release.yml/badge.svg)](https://github.com/EPMatt/reviewdog-action-prettier/actions/workflows/release.yml)\n[![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/EPMatt/reviewdog-action-prettier?logo=github\u0026sort=semver)](https://github.com/EPMatt/reviewdog-action-prettier/releases)\n[![action-bumpr supported](https://img.shields.io/badge/bumpr-supported-ff69b4?logo=github\u0026link=https://github.com/haya14busa/action-bumpr)](https://github.com/haya14busa/action-bumpr)\n\n\u003ca href=\"https://www.buymeacoffee.com/epmatt\"\u003e\u003cimg width=\"150\" alt=\"yellow-button\" src=\"https://user-images.githubusercontent.com/30753195/133942263-5fef0166-4ab5-4529-b931-37b5d14f02bf.png\"\u003e\u003c/a\u003e\n\nThis GitHub Action runs [prettier](https://prettier.io/) with [reviewdog](https://github.com/reviewdog/reviewdog) to improve code checking, formatting and review experience for your codebase. :dog:\n\nThe action will first run Prettier, then passing the tool's output to reviewdog for further processing. Depending on the action configuration, reviewdog will then provide a GitHub check either with code annotations or with a Pull Request review.\n\nFor full documentation regarding reviewdog, its features and configuration options, please visit the [reviewdog repository](https://github.com/reviewdog/reviewdog).\n\n## See it in action!\n\nCheck out the [Sample PR](https://github.com/EPMatt/reviewdog-action-prettier/pull/6) for an example usage of this action.\n\n### With `github-check` or `github-pr-check` reporters\n\n![reviewdog-action-prettier-github-check](https://user-images.githubusercontent.com/30753195/156574262-ea7f7969-d5c4-4fcc-8727-dcbe08fdb611.png)\n\nIf configured with `github-check` and `github-pr-check` reporters, the action will report Prettier errors and warnings about unformatted files.\n\nAs an example, see what the action reported for the Sample PR [here](https://github.com/EPMatt/reviewdog-action-prettier/pull/6/checks?check_run_id=5399599766).\n\n### With `github-pr-review` reporter\n\n![reviewdog-action-prettier-github-pr-review](https://user-images.githubusercontent.com/30753195/156574285-f6fd599d-af5c-470d-b23b-c7daa92d316f.png)\n\nIf configured with the `github-pr-review` reporter, the action submits a code review including any errors reported by Prettier; moreover, any formatting changes provided by Prettier are attached as code suggestions.\n\nCheck out the [Sample PR _Conversation_ tab](https://github.com/EPMatt/reviewdog-action-prettier/pull/6) to see how the action submitted a code review, including both error reports and formatting suggestions.\n## Input\n\n```yaml\ninputs:\n  github_token:\n    description: 'GITHUB_TOKEN'\n    default: '${{ github.token }}'\n    required: false\n  workdir:\n    description: |\n      Working directory relative to the root directory.\n      This is where the action will look for a\n      package.json which declares Prettier as a dependency.\n      Please note that this is different from the directory\n      Prettier will run on, which is defined in the prettier_flags input.\n      Default is `.`.\n    default: '.'\n    required: false\n  ### Flags for reviewdog ###\n  level:\n    description: |\n      Report level for reviewdog [info,warning,error].\n      Default is `error`.\n    default: 'error'\n    required: false\n  reporter:\n    description: |\n      Reporter of reviewdog command [github-check,github-pr-check,github-pr-review].\n      Default is `github-pr-check`.\n    default: 'github-pr-check'\n    required: false\n  filter_mode:\n    description: |\n      Filtering mode for the reviewdog command [added,diff_context,file,nofilter].\n      Default is `added`.\n    default: 'added'\n    required: false\n  fail_on_error:\n    description: |\n      Exit code for reviewdog when errors are found [true,false].\n      Default is `false`.\n    default: 'false'\n    required: false\n  reviewdog_flags:\n    description: |\n      Additional reviewdog flags.\n      Default is ``.\n    default: ''\n    required: false\n  tool_name:\n    description: 'Tool name to use for reviewdog reporter'\n    default: 'prettier'\n    required: false\n  ### Flags for prettier ###\n  prettier_flags:\n    description: |\n      Flags and args to pass to Prettier.\n      If you override this input, please make sure to append to it the directory\n      which Prettier will run on.\n      The path provided here is relative to the workdir path, provided in the workdir input.\n      Default is `.`, which makes Prettier run on the path provided in the workdir input.\n    default: '.'\n    required: false\n```\n\n## Usage\n\nThis example shows how to configure the action to run on any event occurring on a Pull Request. Reviewdog will report Prettier output messages by opening a code review on the Pull Request which triggered the workflow. Moreover, any formatting changes provided by Prettier will be attached as code suggestions.\n\n```yaml\nname: reviewdog\non: [pull_request]\njobs:\n  prettier:\n    name: runner / prettier\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions/checkout@v2\n      - uses: EPMatt/reviewdog-action-prettier@v1\n        with:\n          github_token: ${{ secrets.github_token }}\n          # Change reviewdog reporter if you need\n          # [github-pr-check,github-check,github-pr-review].\n          # More about reviewdog reporters at\n          # https://github.com/reviewdog/reviewdog#reporters\n          reporter: github-pr-review\n          # Change reporter level if you need\n          # [info,warning,error].\n          # More about reviewdog reporter level at\n          # https://github.com/reviewdog/reviewdog#reporters\n          level: warning\n```\n\n## FAQs\n\n### How do I run the action on a module in a subfolder?\n\nTo run the action on a module in a subfolder, you can change the path where the action will run with the `workdir` input.\n\nPlease note that this setup is relevant only if your repository includes a module in a subfolder, declaring `prettier` as a dependency in its `package.json`. If you just want to run Prettier in a subfolder, read [this FAQ](#how-do-i-include-or-exclude-certain-files-and-folders) to learn how to include or exclude certain files and folders.\n\n```yaml\nname: reviewdog\non: [pull_request]\njobs:\n  prettier:\n    name: runner / prettier\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions/checkout@v2\n      - uses: EPMatt/reviewdog-action-prettier@v1\n        with:\n          github_token: ${{ secrets.github_token }}\n          reporter: github-pr-review\n          level: warning\n          # The action will look for a package.json file with prettier\n          # declared as a dependency located in the \"foo\" subfolder.\n          workdir: foo\n```\n\n### How do I run the action on multiple modules?\n\nFor more complex setups which require to run the action on multiple modules, run the action once for each single module, changing the `workdir` and `prettier_flags` inputs accordingly.\n\nPlease note that this setup is relevant only if you have multiple submodules in your repository, each of them declaring `prettier` as a dependency in their `package.json`. If you just want to include or exclude certain files and folders from prettier, read [this FAQ](#how-do-i-include-or-exclude-certain-files-and-folders).\n\n```yaml\nname: reviewdog\non: [pull_request]\njobs:\n  prettier:\n    name: runner / prettier\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions/checkout@v2\n      # Run action for the \"submodule1\" module\n      - uses: EPMatt/reviewdog-action-prettier@v1\n        with:\n          github_token: ${{ secrets.github_token }}\n          reporter: github-pr-review\n          level: warning\n          # The action will look for a package.json file with prettier\n          # declared as a dependency located in the \"submodule1\" subfolder.\n          workdir: submodule1\n      # Run action for the \"submodule2\" module\n      - uses: EPMatt/reviewdog-action-prettier@v1\n        with:\n          github_token: ${{ secrets.github_token }}\n          reporter: github-pr-review\n          level: warning\n          # The action will look for a package.json file with prettier\n          # declared as a dependency located in the \"submodule2\" subfolder.\n          workdir: submodule2\n```\n\n### How do I include or exclude certain files and folders?\n\nYou can select which files Prettier will run on by either configuring it with a [configuration file](https://prettier.io/docs/en/configuration.html) or by providing the appropriate [CLI flags](https://prettier.io/docs/en/cli.html).\n\nWhen using this action, custom flags can be supplied to Prettier via the `prettier_flags` input.\nPlease note that the `file/dir/glob` parameter provided in `prettier_flags` input is relative to the path provided in the `workdir` input.\n\nThe following example workflow runs when a push is performed on the `main` branch. The `prettier` job runs the tool only on `.jsx` files included in the repository.\n\n```yaml\nname: reviewdog\non:\n  push:\n    branches:\n      - main\njobs:\n  prettier:\n    name: runner / prettier\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions/checkout@v2\n      - uses: EPMatt/reviewdog-action-prettier@v1\n        with:\n          github_token: ${{ secrets.github_token }}\n          reporter: github-pr-review\n          level: warning\n          # The action will look for a package.json file with prettier\n          # declared as a dependency located in the repo root directory.\n          workdir: .\n          # Run only on files with the .jsx extension\n          prettier_flags: *.jsx\n```\n\n\n### Why can't I see the results?\n\nTry looking into the `filter_mode` options explained [here](https://github.com/reviewdog/reviewdog#filter-mode). Prettier errors and warnings will sometimes appear in lines or files that weren't modified by the commit the workflow run is associated with, which instead get filtered with the default `added` option.\n\n### Why does the action require a `package.json` with `prettier` declared as a dependency?\n\nThe action will automatically install Prettier from a `package.json` in the `workdir` path. However, it will not choose a Prettier version and install it for you if `package.json` is missing in the provided `workdir` or it does not declare Prettier as a dependency.\n\nDifferent Prettier versions might result in different formatting; indeed, [the official documentation](https://prettier.io/docs/en/install.html#summary) suggests to install an exact version in your project to avoid any formatting changes and issues due to non-identical Prettier versions. Therefore, the action leaves you to decide which version of Prettier should be executed. \n\nThe action does not provide a custom input for specifying the Prettier version; instead, you should use a `package.json` file, and add `prettier` as a dependency. Please read the [Prettier installation guide](https://prettier.io/docs/en/install.html) for more.\n\nUsing a `package.json` file is the most practical and standardized way to declare Node dependencies, and it will also allow you to automate dependency updates and local installation with other tools.\n\n## Contributing\n\nWant to improve this action? Cool! :rocket: Please make sure to read the [Contribution Guidelines](CONTRIBUTING.md) prior submitting your work.\n\nAny feedback, suggestion or improvement is highly appreciated!\n\n## Sponsoring\n\nIf you want to show your appreciation and support maintenance and future development of this action, please consider **making a small donation [here](https://www.buymeacoffee.com/epmatt)**. :coffee:\n\nMoreover, if you like this project don't forget to **leave a star on [GitHub](https://github.com/EPMatt/reviewdog-action-prettier)**. Such a quick and zero-cost act will allow the action to get more visibility across the community, resulting in more people getting to know and using it. :star:\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fepmatt%2Freviewdog-action-prettier","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fepmatt%2Freviewdog-action-prettier","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fepmatt%2Freviewdog-action-prettier/lists"}