How dberna2/check-style works
Project type and purpose
• This is an open-source GitHub Action that wraps Checkstyle for Java & ReviewDog to automate static code analysis in a PR workflow.
• It’s a DevOps‐focused tool, not a full-stack app—its “system” lives entirely inside a CI runner and interfaces with GitHub’s APIs.
File structure
• action.yml – declares inputs, outputs, metadata for the GitHub Action.
• Dockerfile – builds the container image that bundles ReviewDog, Checkstyle, and your entrypoint script.
• entrypoint.sh – the shell script that runs inside the container: reads inputs, invokes Checkstyle via ReviewDog, processes results.
• .gitignore, README.md – documentation and ignore rules.
Key external dependencies (from README)
• ReviewDog CLI (for running checkstyle and posting results)
• Checkstyle (Java static analysis engine)
• GitHub Actions runner + GitHub API (to post annotations or checks)
Main components & their relationships
a. GitHub Actions Runner (host VM or container)
• Pulls your repo code (via actions/checkout)
• Reads workflow YAML to launch this Action
b. Action Container (built by Dockerfile)
• Entrypoint script (entrypoint.sh)
• ReviewDog binary (bundled in container)
• Checkstyle jar(s) & config file(s) (google_checks.xml or custom)
c. Inputs/Configs (in action.yml & workflow)
• github_token, reporter, level, checkstyle_config, use_custom_validations, custom_validations, excluded_paths, workdir, etc.
d. External Services
• GitHub API – for PR comments, check runs, review annotations
e. Code under test
• Java sources in user’s repo, scanned by Checkstyle
Data flow:
1. Runner starts job → checks out code
2. Runner pulls & runs your Action container → entrypoint.sh
3. entrypoint.sh reads inputs → builds ReviewDog command line
4. ReviewDog launches Checkstyle on the working directory (workdir)
5. Checkstyle produces XML/console output → ReviewDog parses it
6. ReviewDog uses github_token to POST annotations/checks back to the PR via GitHub API
Architectural patterns & design principles
• Single-container wrapper: isolates dependencies
• Declarative inputs (action.yml) → decouples configuration from code
• Script-based orchestration (entrypoint.sh) following the “one logical action per container” principle
• Pluggable rules: supports default vs custom Checkstyle config and custom validation JARs