Checking C# program for bad code

Hello! My task is to check C# program for bad code via Mono.Gendarme package. I’ve create the test repo with ci.yml:

name: CI

on:
  push:
    branches: [ main ]
  pull_request:
    branches: [ main ]

  workflow_dispatch:

jobs:
  build:
    runs-on: ubuntu-20.04

    steps:
      - uses: actions/checkout@v2

      - name: Mono build
        run: |
          mcs -target:library -out:main.dll MatrixUtils.cs
    
  check:
    runs-on: ubuntu-20.04

    steps:
      - uses: actions/checkout@v2

      - name: Gendarme check
        run: |
          # Update the list of packages
          sudo apt-get update
          # Install pre-requisite packages.
          sudo apt-get install -y wget apt-transport-https software-properties-common
          # Download the Microsoft repository GPG keys
          wget -q https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb
          # Register the Microsoft repository GPG keys
          sudo dpkg -i packages-microsoft-prod.deb
          # Update the list of products
          sudo apt-get update
          # Enable the "universe" repositories
          sudo add-apt-repository universe
          # Install PowerShell
          sudo apt-get install -y powershell
          # Start PowerShell
          pwsh -Command { Install-Package Mono.Gendarme -Version 2.11.0.20121120 }
          gendarme main.dll

But check job fails with 127 error code: /home/runner/work/_temp/62e27cd2-b65e-4cf3-8f23-b46f9d895406.sh: line 17: gendarme: command not found. How to fix it?

It looks like your last commands did not work properly. Is that last powershell command working for you locally? Maybe there is a apt-get package as an alternative Installation.