Skip to content

Commit

Permalink
ci: Add linting action
Browse files Browse the repository at this point in the history
  • Loading branch information
mcliment committed May 3, 2024
1 parent 9439734 commit 8203ddc
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@
"commands": [
"reportgenerator"
]
},
"csharpier": {
"version": "0.28.2",
"commands": [
"dotnet-csharpier"
]
}
}
}
40 changes: 40 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Lint Code and Create PR

on:
workflow_dispatch:

jobs:
lint-and-create-pr:
runs-on: ubuntu-latest

steps:
- name: 🤘 Checkout
uses: actions/checkout@v4

- name: 📦 Install dependencies
run: dotnet tool restore

- name: 🧹 Format C# files
run: dotnet csharpier .

- name: Create Pull Request with applied fixes
uses: peter-evans/create-pull-request@v6
id: cpr
with:
token: ${{ secrets.GITHUB_TOKEN }}
branch: csharp-lint
commit-message: "[CSharpier] Apply linters automatic fixes"
title: "[CSharpier] Apply linters automatic fixes"
labels: bot

- name: Create PR output
run: |
echo "PR Number - ${{ steps.cpr.outputs.pull-request-number }}"
echo "PR URL - ${{ steps.cpr.outputs.pull-request-url }}"
- name: Commit and push applied linter fixes
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: "[CSharpier] Apply linters fixes"
commit_user_name: csharpier-bot
commit_user_email: 41898282+github-actions[bot]@users.noreply.github.com

0 comments on commit 8203ddc

Please sign in to comment.