You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
recyclarr/.github/workflows/inspect-code.yml

82 lines
2.0 KiB

# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: Inspect Code
on:
push:
branches: ["**"]
tags: ["!**"]
paths:
- .github/workflows/inspect-code.yml
- '**.cs'
pull_request:
paths:
- .github/workflows/inspect-code.yml
- '**.cs'
env:
BASE_REF: ${{ github.ref == 'refs/heads/master' && github.event.before ||
(github.event.base_ref || github.event.pull_request.base.ref || 'master') }}
jobs:
inspect:
name: Resharper Inspect Code
runs-on: ubuntu-latest
steps:
- name: Checkout Source Code
uses: actions/checkout@v3
with:
fetch-depth: 0 # avoid shallow clone for GitVersion
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 7.0.x
- name: Restore
run: dotnet restore src
- name: Inspect Code
uses: muno92/resharper_inspectcode@1.6.8
with:
workingDirectory: src
solutionPath: Recyclarr.sln
minimumSeverity: warning
include: '**.cs'
cleanup:
name: Resharper Code Cleanup
runs-on: ubuntu-latest
steps:
- name: Checkout Source Code
uses: actions/checkout@v3
with:
fetch-depth: 0 # avoid shallow clone for GitVersion
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 7.0.x
- name: Install Resharper Tools
run: dotnet tool install -g JetBrains.ReSharper.GlobalTools
- name: Build
run: dotnet build src
- name: Run Code Cleanup
run: ../ci/code_cleanup.sh "${{ env.BASE_REF }}"
working-directory: src
- name: Check Diff
run: |
ci/diff_to_errors.sh
set -o pipefail
git diff --exit-code | tee code-cleanup.patch
- name: Publish Patch File
uses: actions/upload-artifact@v3
if: failure()
with:
name: code-cleanup-patch-files
path: '*.patch'