GitHub CSharpier Linter Action
[](https://github.com/guibranco/github-csharpier-linter-action)
[](https://github.com/guibranco/github-csharpier-linter-action)
[](https://github.com/guibranco/github-csharpier-linter-action)

[](https://wakatime.com/badge/github/guibranco/github-csharpier-linter-action)
π 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/github-csharpier-linter-action@v1.0.5
β‘ 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/github-csharpier-linter-action@v1.0.5
π§ How It Works
- Setup .NET: Ensures that .NET SDK is installed.
- Run CSharpier: Runs
dotnet csharpier check .
and checks for any formatting issues. - 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.