Skip to content

CI speed-up @github-actions pre-commit by only running it on changed files #38862

Closed
@MarcoGorelli

Description

@MarcoGorelli

From #38858 it seems the actions works fine, though is perhaps a bit slow as it has to run on all files

If we apply the diff

diff --git a/.github/workflows/comment_bot.yml b/.github/workflows/comment_bot.yml
index 98b8e10f6..dc396be75 100644
--- a/.github/workflows/comment_bot.yml
+++ b/.github/workflows/comment_bot.yml
@@ -29,7 +29,7 @@ jobs:
       - name: Install-pre-commit
         run: python -m pip install --upgrade pre-commit
       - name: Run pre-commit
-        run: pre-commit run --all-files || (exit 0)
+        run: pre-commit run --from-ref=origin/master --to-ref=HEAD --all-files || (exit 0)
       - name: Commit results
         run: |
           git config user.name "$(git log -1 --pretty=format:%an)"

then it should run much faster

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions