Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
MarcoGorelli opened this issue Dec 31, 2020 · 3 comments · Fixed by #39505
Closed

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

MarcoGorelli opened this issue Dec 31, 2020 · 3 comments · Fixed by #39505
Assignees
Labels
CI Continuous Integration Code Style Code style, linting, code_checks good first issue

Comments

@MarcoGorelli
Copy link
Member

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

@MarcoGorelli MarcoGorelli added CI Continuous Integration Code Style Code style, linting, code_checks good first issue labels Dec 31, 2020
@gunjan-solanki
Copy link
Contributor

take

@gunjan-solanki
Copy link
Contributor

Apologies for inaction. I got caught up in some work. I will raise a PR this weekend.

@MarcoGorelli
Copy link
Member Author

no hurry, ping when it's ready :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI Continuous Integration Code Style Code style, linting, code_checks good first issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants