From 59160bafc45a6ad4b80cff0f1821ee519a8ae357 Mon Sep 17 00:00:00 2001 From: Sella-GH <147769367+Sella-GH@users.noreply.github.com> Date: Sat, 18 May 2024 15:25:36 +0200 Subject: [PATCH] Try auto approve from codeql --- .github/workflows/codeql.yml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 0a3ba39c..ed50e4f5 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -34,6 +34,7 @@ jobs: permissions: # required for all workflows security-events: write + pull-requests: write # only required for workflows in private repositories actions: read @@ -87,3 +88,21 @@ jobs: uses: github/codeql-action/analyze@v3 with: category: "/language:${{matrix.language}}" + + - name: Check CodeQL Results + if: ${{ github.event.name == 'pull_request' }} + id: check_codeql + run: | + if [ -f /home/runner/work/AzzyBot/results/csharp.sarif ]; then + RESULTS=$(jq '.runs[].results | length' /home/runner/work/AzzyBot/results/csharp.sarif) + echo "results=$RESULTS" >> "$GITHUB_OUTPUT" + else + echo "results=0" >> "$GITHUB_OUTPUT" + fi + + - name: + if: ${{ steps.check_codeql.outputs.results == '0' && github.event.name == 'pull_request' }} + run: | + gh pr review ${{ github.event.pull_request.number }} --approve + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}