Skip to content

guibranco/github-csharpier-linter-action

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

40 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

GitHub CSharpier Linter Action

GitHub repo GitHub last commit GitHub license CI wakatime

πŸ“‹ Overview

A GitHub Action to automatically check and enforce C# code formatting using CSharpier. This action helps maintain clean code by running formatting checks and posting annotations, job summaries, and PR comments when issues are detected.

πŸ›  Features

  • Automatic formatting check: Uses dotnet csharpier check . to validate the formatting of all C# files.
  • Job summary: Uploads a neat, easy-to-read summary in the GitHub Actions interface.
  • Inline annotations: Adds warnings in the code where formatting is incorrect.
  • PR comments: Posts a comment on the pull request with the list of issues detected.

🧩 Usage

You can use this action in your workflows by referencing it as a reusable workflow:

jobs:
  linter-check:
    runs-on: ubuntu-latest
    permissions:
      pull-requests: write
    steps:
      - name: CSharpier Linter
        uses: guibranco/[email protected]

⚑ Requirements

  • C# files should be part of your repository.
  • Make sure your repository has .cs files, .csproj, or similar files that are relevant to the format.

πŸ“ Outputs

  • Job summary: Available in the PR Checks section, clearly summarizing the formatting issues.
  • Annotations: Warning annotations are placed on the lines where formatting issues are found.
  • PR Comments: An easy-to-read comment posted directly on the PR.

πŸ’‘ Example Workflow

Here’s an example workflow that uses this action:

name: Linter check

on:
  workflow_dispatch:
  pull_request:

jobs:
  linter-check:
    runs-on: ubuntu-latest
    permissions:
      pull-requests: write
    steps:
      - name: CSharpier Linter
        uses: guibranco/[email protected]

πŸ”§ How It Works

  1. Setup .NET: Ensures that .NET SDK is installed.
  2. Run CSharpier: Runs dotnet csharpier check . and checks for any formatting issues.
  3. Create Annotations and PR Comments: If issues are found, the action creates inline annotations, a job summary, and a comment on the PR.

πŸ›  Development

To contribute to this action:

  • Clone the repository and test locally.
  • Make sure to follow best practices for creating GitHub Actions.

πŸš€ Installation & Contribution

  • Clone this repo to use in your own workflows.
  • Feel free to open issues or submit pull requests to improve the action!

πŸ† License

This project is licensed under the MIT License - see the LICENSE file for details.

About

🎯 A reusable GitHub Action to automatically check and enforce C# code formatting using CSharpier

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Contributors 5