From 57856bcbb996f38e0b373b1ffb24220026dde3a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edouard=20Choini=C3=A8re?= <27212526+echoix@users.noreply.github.com> Date: Thu, 4 Jul 2024 16:03:54 -0400 Subject: [PATCH] CI(ruff): Fine tune posting Ruff suggestions (#3978) * CI(ruff): Fix typo in ruff suggestions * CI(ruff): Upload suggestions even if not all linting errors were fixed * CI(ruff): Try suggesting more changes * CI(ruff): Upload suggestions even if not all linting errors were fixed but do not run when cancelled --- .github/workflows/post-pr-reviews.yml | 2 +- .github/workflows/python-code-quality.yml | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/post-pr-reviews.yml b/.github/workflows/post-pr-reviews.yml index e35d58be50e..00f7c5f828e 100644 --- a/.github/workflows/post-pr-reviews.yml +++ b/.github/workflows/post-pr-reviews.yml @@ -85,7 +85,7 @@ jobs: CI_REPO_NAME: ${{ github.event.workflow_run.repository.name }} # CI_PULL_REQUEST: "" # Populated from reviewdog's "-guess" flag since hard to get - name: Post Ruff suggestions - if: ${{ steps.tools.outputs.black == 'true' }} + if: ${{ steps.tools.outputs.ruff == 'true' }} run: | TMPFILE="diff-${INPUT_TOOL_NAME}.patch" GITHUB_ACTIONS="" reviewdog \ diff --git a/.github/workflows/python-code-quality.yml b/.github/workflows/python-code-quality.yml index 9565c32eaea..1f28d13b5d8 100644 --- a/.github/workflows/python-code-quality.yml +++ b/.github/workflows/python-code-quality.yml @@ -67,10 +67,12 @@ jobs: - name: Install Ruff run: pip install ruff==${{ env.RUFF_VERSION }} - name: Run Ruff - run: ruff check --output-format=github . --preview --fix + run: ruff check --output-format=github . --preview --fix --unsafe-fixes - name: Create and uploads code suggestions to apply for Ruff # Will fail fast here if there are changes required id: diff-ruff + # To run after ruff step exits with failure when rules don't have fixes available + if: ${{ !cancelled() }} uses: ./.github/actions/create-upload-suggestions with: tool-name: ruff