From 9bcb445b4546f66f409acfb9b466e40b482df0f5 Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Mon, 26 Aug 2024 20:43:51 +0800 Subject: [PATCH 1/8] Temporarily set pre-commit-hooks to old tag --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index d758c6b5187..676ecc2625b 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -2,7 +2,7 @@ # See https://pre-commit.com/hooks.html for more hooks repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.6.0 + rev: v4.5.0 hooks: - id: check-added-large-files - id: check-yaml From 24cc991d2ca028909f8aced830b56c9ac3dbb5d8 Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Mon, 26 Aug 2024 20:44:50 +0800 Subject: [PATCH 2/8] Autoupdate pre-commit hooks in the Style Checks workflow --- .github/workflows/style_checks.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/style_checks.yaml b/.github/workflows/style_checks.yaml index 119f1200066..dab25a9236e 100644 --- a/.github/workflows/style_checks.yaml +++ b/.github/workflows/style_checks.yaml @@ -42,6 +42,9 @@ jobs: make check pre-commit run --all-files + - name: Update pre-commit hooks + run: pre-commit autoupdate + - name: Ensure example scripts have at least one code block separator run: | git ls-files 'examples/**/*.py' | xargs grep --files-without-match '# %%' > output.txt From 657c50c39cdf05510dd6d8494d2f3596f49a7b9d Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Mon, 26 Aug 2024 20:49:00 +0800 Subject: [PATCH 3/8] Fail the workflow if there are newer hooks --- .github/workflows/style_checks.yaml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/style_checks.yaml b/.github/workflows/style_checks.yaml index dab25a9236e..89a421df789 100644 --- a/.github/workflows/style_checks.yaml +++ b/.github/workflows/style_checks.yaml @@ -37,14 +37,16 @@ jobs: python -m pip install ruff pre-commit python -m pip list + - name: Check updates of pre-commit hooks + run: | + pre-commit autoupdate + if [[ $(git ls-files -m) ]]; then git --no-pager diff HEAD; exit 1; fi + - name: Formatting check (ruff + pre-commit) run: | make check pre-commit run --all-files - - name: Update pre-commit hooks - run: pre-commit autoupdate - - name: Ensure example scripts have at least one code block separator run: | git ls-files 'examples/**/*.py' | xargs grep --files-without-match '# %%' > output.txt From 4d2af04fd1814228dc931f0a1d7e1bcdc6e132fd Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Tue, 27 Aug 2024 15:39:54 +0800 Subject: [PATCH 4/8] Add workflow_dispatch so the workflow can be triggered manually --- .github/workflows/style_checks.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/style_checks.yaml b/.github/workflows/style_checks.yaml index 89a421df789..d25ee1aa40d 100644 --- a/.github/workflows/style_checks.yaml +++ b/.github/workflows/style_checks.yaml @@ -12,6 +12,7 @@ on: push: branches: [ main ] pull_request: + workflow_dispatch: # Schedule daily tests schedule: - cron: '0 0 * * *' From 6458bb307c541a493ddae464ccc6d244564039fe Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Tue, 27 Aug 2024 15:42:40 +0800 Subject: [PATCH 5/8] Enable the workflow in schedule or workflow_dispatch events --- .github/workflows/style_checks.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/style_checks.yaml b/.github/workflows/style_checks.yaml index d25ee1aa40d..68179563e1b 100644 --- a/.github/workflows/style_checks.yaml +++ b/.github/workflows/style_checks.yaml @@ -42,6 +42,7 @@ jobs: run: | pre-commit autoupdate if [[ $(git ls-files -m) ]]; then git --no-pager diff HEAD; exit 1; fi + if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' - name: Formatting check (ruff + pre-commit) run: | From 359e1c901788af6e18b6af49966d347905c9c8b7 Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Tue, 27 Aug 2024 17:27:13 +0800 Subject: [PATCH 6/8] Revert changes in style checks workflow --- .github/workflows/style_checks.yaml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/.github/workflows/style_checks.yaml b/.github/workflows/style_checks.yaml index 68179563e1b..119f1200066 100644 --- a/.github/workflows/style_checks.yaml +++ b/.github/workflows/style_checks.yaml @@ -12,7 +12,6 @@ on: push: branches: [ main ] pull_request: - workflow_dispatch: # Schedule daily tests schedule: - cron: '0 0 * * *' @@ -38,12 +37,6 @@ jobs: python -m pip install ruff pre-commit python -m pip list - - name: Check updates of pre-commit hooks - run: | - pre-commit autoupdate - if [[ $(git ls-files -m) ]]; then git --no-pager diff HEAD; exit 1; fi - if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' - - name: Formatting check (ruff + pre-commit) run: | make check From e789f55687dc5983282187f0e5c1c70bbeaca707 Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Tue, 27 Aug 2024 17:27:49 +0800 Subject: [PATCH 7/8] Revert temporary changes in .pre-commit-config.yaml --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 676ecc2625b..d758c6b5187 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -2,7 +2,7 @@ # See https://pre-commit.com/hooks.html for more hooks repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.5.0 + rev: v4.6.0 hooks: - id: check-added-large-files - id: check-yaml From 6709bfa94603637859122b5b7d1f0e787bea0c87 Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Tue, 27 Aug 2024 17:29:00 +0800 Subject: [PATCH 8/8] Add configurations for pre-commit.ci --- .pre-commit-config.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index d758c6b5187..328813ae7bc 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -15,3 +15,8 @@ repos: - id: remove-crlf - id: chmod args: ['644'] + +# https://pre-commit.ci/#configuration +ci: + autofix_prs: false + autoupdate_schedule: quarterly