GitHub Detekt action with Detekt 1.19.0

I created a github action config for detekt 1.19.0 based on Java 17 because the template from GitHub was using a much older version and also didn’t work for me.

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
#
# This workflow performs a static analysis of your Kotlin source code using
# Detekt.
#
# Scans are triggered:
# 1. On every push to default and protected branches
# 2. On every Pull Request targeting the default branch
# 3. On a weekly schedule
# 4. Manually, on demand, via the "workflow_dispatch" event
name: Scan with Detekt

on:
  # Triggers the workflow on push or pull request events but only for default and protected branches
  push:
    branches: [ develop ]
  pull_request:
    branches: [ develop ]
  schedule:
     - cron: '31 13 * * 1'

  # Allows you to run this workflow manually from the Actions tab
  workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
  # This workflow contains a single job called "scan"
  scan:
    name: Scan
    # The type of runner that the job will run on
    runs-on: ubuntu-latest

    # Steps represent a sequence of tasks that will be executed as part of the job
    steps:
    # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
    - uses: actions/checkout@v2
    - name: Set up JDK 17
      uses: actions/setup-java@v2
      with:
        java-version: '17'
        distribution: 'temurin'

    # Sets up the detekt cli
    - name: Setup detekt
      id: setup_detekt
      run: |
        dest=$( mktemp -d )
        DETEKT_FILE=$dest/detekt-cli-all.jar
        curl --request GET \
          --url https://github.com/detekt/detekt/releases/download/v1.19.0/detekt-cli-1.19.0-all.jar \
          --silent \
          --location \
          --output $DETEKT_FILE
        echo "::set-output name=detekt_file::$DETEKT_FILE"

    # Performs static analysis using Detekt
    - name: Run Detekt
      continue-on-error: true
      run: |
        java -jar ${{ steps.setup_detekt.outputs.detekt_file }} --input ${{ github.workspace }} --report sarif:${{ github.workspace }}/detekt.sarif.json

    # Modifies the SARIF output produced by Detekt so that absolute URIs are relative
    # This is so we can easily map results onto their source files
    # This can be removed once relative URI support lands in Detekt: https://git.io/JLBbA
    - name: Make artifact location URIs relative
      continue-on-error: true
      run: |
        echo "$(
          jq \
            --arg github_workspace ${{ github.workspace }} \
            '. | ( .runs[].results[].locations[].physicalLocation.artifactLocation.uri |= if test($github_workspace) then .[($github_workspace | length | . + 1):] else . end )' \
            ${{ github.workspace }}/detekt.sarif.json
        )" > ${{ github.workspace }}/detekt.sarif.json

    # Uploads results to GitHub repository using the upload-sarif action
    - uses: github/codeql-action/upload-sarif@v1
      with:
        # Path to SARIF file relative to the root of the repository
        sarif_file: ${{ github.workspace }}/detekt.sarif.json
        checkout_path: ${{ github.workspace }}