From 222a028159640bbc4ef36dc6b7de342c30da08db Mon Sep 17 00:00:00 2001 From: Justin Chu Date: Sat, 4 Feb 2023 21:23:41 -0800 Subject: [PATCH] SARIF --- .github/workflows/Lint.yml | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/.github/workflows/Lint.yml b/.github/workflows/Lint.yml index cb8bf7a..4dcd336 100644 --- a/.github/workflows/Lint.yml +++ b/.github/workflows/Lint.yml @@ -36,10 +36,16 @@ jobs: echo -e "\e[1m\e[36mYou can reproduce these results locally by using \`lintrunner -m main\`.\e[0m" exit 1 fi - - name: Store annotations - continue-on-error: true + - name: Produce SARIF + if: always() && matrix.os == 'ubuntu-latest' run: | - # Use jq to massage the JSON lint output into GitHub Actions workflow commands. - jq --raw-output \ - '"::\(if .severity == "advice" or .severity == "disabled" then "warning" else .severity end) file=\(.path),line=\(.line),col=\(.char),title=\(.code) \(.name)::" + (.description | gsub("\\n"; "%0A"))' \ - lint.json + python tools/convert_to_sarif.py --input lint.json --output lintrunner.sarif + - name: Upload SARIF file + if: always() && matrix.os == 'ubuntu-latest' + continue-on-error: true + uses: github/codeql-action/upload-sarif@v2 + with: + # Path to SARIF file relative to the root of the repository + sarif_file: lintrunner.sarif + category: lintrunner + checkout_path: ${{ github.workspace }}