From 6a6fd4be1c749161ff28f5ff1435bbcef0a81ea1 Mon Sep 17 00:00:00 2001 From: "Mr. M" Date: Sun, 12 Oct 2025 11:29:04 +0200 Subject: [PATCH] chore: Only run autopep8 if python files changed, b=no-bug, c=workflows --- .github/workflows/code-linter.yml | 7 +++++-- package.json | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/code-linter.yml b/.github/workflows/code-linter.yml index 74e17d709..decb9dcac 100644 --- a/.github/workflows/code-linter.yml +++ b/.github/workflows/code-linter.yml @@ -27,8 +27,11 @@ jobs: with: node-version-file: '.nvmrc' - - name: Setup autopep8 - run: sudo apt install python3-autopep8 + - name: Setup and run autopep8 + if: ${{ contains(join(github.event.commits.*.modified, ' '), '.py') || contains(join(github.event.commits.*.added, ' '), '.py') || contains(join(github.event.commits.*.removed, ' '), '.py') }} + run: | + sudo apt install python3-autopep8 + autopep8 --diff scripts/ src/ - name: Install dependencies run: npm ci diff --git a/package.json b/package.json index 107ddd6cd..4d980483e 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,7 @@ "update-ff:rc": "python3 scripts/update_ff.py --rc", "update-ff:l10n": "python3 scripts/update_ff.py --just-l10n", "pretty": "prettier . --write --cache && autopep8 -r --in-place scripts/ src/", - "lint": "npx eslint src/ && prettier . --check && autopep8 --diff scripts/ src/", + "lint": "npx eslint src/ && prettier . --check --cache", "lint:fix": "npm run pretty && npx eslint src/ --fix", "prepare": "husky", "reset-ff": "surfer reset",