diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index 291f210..becfa34 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -13,6 +13,12 @@ "commands": [ "reportgenerator" ] + }, + "csharpier": { + "version": "0.28.2", + "commands": [ + "dotnet-csharpier" + ] } } } \ No newline at end of file diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..ab97db7 --- /dev/null +++ b/.github/workflows/lint.yml @@ -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