action-checkstyle
action-checkstyle copied to clipboard
reviewdog based GitHub action to run Checkstyle on your Java code.
Checkstyle for Java GitHub Action
This is a GitHub action to run Checkstyle checks on your Java code and report the status via reviewdog on pull requests.
Example
An example of how the reported Checkstyle violations will look on a pull request is shown below (link to example PR):

Usage
name: reviewdog
on: [pull_request]
jobs:
checkstyle:
name: runner / checkstyle
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dbelyaev/action-checkstyle@master
with:
github_token: ${{ secrets.github_token }}
reporter: github-pr-review
level: warning
Input parameters
Checkstyle parameters
-
checkstyle_configCheckstyle configuration specifies which ruleset to apply during the scan.
There are two built-in configurations:google_checks.xmlconfig for the Google coding conventionssun_checks.xmlconfig for the Sun coding conventions
It is also possible to supply your custom Checkstyle configuration file located in the same directory.
Default:google_checks.xmlExample:name: reviewdog on: [pull_request] jobs: checkstyle: name: runner / checkstyle runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: dbelyaev/action-checkstyle@master with: github_token: ${{ secrets.github_token }} reporter: github-pr-review checkstyle_config: sun_checks.xmlLink to example PR.
-
checkstyle_versionCheckstyle version to be used during analysis.
For a list of available version numbers, go to the Checkstyle release page.
[!IMPORTANT] This field will always try to follow Checkstyle releases as closely as possible and will use the latest available version by default.
If the default preference is not suitable for your project, please pin the needed version using this property.
Default:latest availableExample:name: reviewdog on: [pull_request] jobs: checkstyle: name: runner / checkstyle runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: dbelyaev/action-checkstyle@master with: github_token: ${{ secrets.github_token }} reporter: github-pr-review checkstyle_version: "9.0" # double quotes important here -
workdirThe working directory relative to the root directory.
Default:'.'(root) -
properties_fileLocation of the properties file relative to the root directory.
This file serves as a means to resolve repetitive or predefined values within the checkstyle configuration file.
Default:''(empty)Example:name: reviewdog on: [pull_request] jobs: checkstyle: name: runner / checkstyle runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: dbelyaev/action-checkstyle@master with: github_token: ${{ secrets.github_token }} reporter: github-pr-review checkstyle_config: ./properties_file/test_checks.xml properties_file: ./properties_file/additional.propertiesLink to example PR.
Reviewdog parameters
-
levelReport level for the reviewdog command.
Values:[info, warning, error]You can control GitHub status check result with this feature.
Level GitHub Status infoneutral warningneutral errorfailure Default:info -
reporterReporter for the reviewdog command.
For more information, check reviewdog / reporters documentation.
Values:[github-pr-check, github-check, github-pr-review]Default:github-pr-check -
filter_modeFiltering mode for the reviewdog command.
For more information, check reviewdog / filter-mode documentation.
Values:[added, diff_context, file, nofilter]Default:added -
fail_on_errorExit code for reviewdog when errors are found.
Values:[true, false]Default:false -
reviewdog_flagsAdditional reviewdog flags.
Default:``