mirror of
https://github.com/ivuorinen/actions.git
synced 2026-02-15 19:48:03 +00:00
feat: add GitHub Actions workflows for code quality and automation (#2)
This commit is contained in:
29
csharp-lint-check/README.md
Normal file
29
csharp-lint-check/README.md
Normal file
@@ -0,0 +1,29 @@
|
||||
# ivuorinen/actions/csharp-lint-check
|
||||
|
||||
## C# Lint Check
|
||||
|
||||
### Description
|
||||
|
||||
Runs linters like StyleCop or dotnet-format for C# code style checks.
|
||||
|
||||
### Inputs
|
||||
|
||||
| name | description | required | default |
|
||||
| ---------------- | ---------------------------------- | -------- | ------- |
|
||||
| `dotnet-version` | <p>Version of .NET SDK to use.</p> | `false` | `""` |
|
||||
|
||||
### Runs
|
||||
|
||||
This action is a `composite` action.
|
||||
|
||||
### Usage
|
||||
|
||||
```yaml
|
||||
- uses: ivuorinen/actions/csharp-lint-check@main
|
||||
with:
|
||||
dotnet-version:
|
||||
# Version of .NET SDK to use.
|
||||
#
|
||||
# Required: false
|
||||
# Default: ""
|
||||
```
|
||||
45
csharp-lint-check/action.yml
Normal file
45
csharp-lint-check/action.yml
Normal file
@@ -0,0 +1,45 @@
|
||||
---
|
||||
# yaml-language-server: $schema=https://json.schemastore.org/github-action.json
|
||||
name: 'C# Lint Check'
|
||||
description: 'Runs linters like StyleCop or dotnet-format for C# code style checks.'
|
||||
author: 'Ismo Vuorinen'
|
||||
|
||||
branding:
|
||||
icon: 'code'
|
||||
color: 'blue'
|
||||
|
||||
inputs:
|
||||
dotnet-version:
|
||||
description: 'Version of .NET SDK to use.'
|
||||
required: false
|
||||
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- name: Detect .NET SDK Version
|
||||
uses: ivuorinen/actions/dotnet-version-detect@main
|
||||
with:
|
||||
default-version: '7.0'
|
||||
|
||||
- name: Setup .NET SDK
|
||||
uses: actions/setup-dotnet@v3
|
||||
with:
|
||||
dotnet-version: '${{ steps.detect-dotnet-version.outputs.dotnet-version }}'
|
||||
|
||||
- name: Install dotnet-format
|
||||
shell: bash
|
||||
run: dotnet tool install --global dotnet-format --version 7.0.1
|
||||
|
||||
- name: Run dotnet-format
|
||||
shell: bash
|
||||
run: |
|
||||
set -eo pipefail
|
||||
if ! dotnet format --check --report sarif --report-file dotnet-format.sarif; then
|
||||
echo "::error::Code formatting issues found. Check the SARIF report for details."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: Upload SARIF Report
|
||||
uses: github/codeql-action/upload-sarif@v2
|
||||
with:
|
||||
sarif_file: dotnet-format.sarif
|
||||
Reference in New Issue
Block a user