From 39bfefb1b19a11672c5f02a7f751e56b0d5327f5 Mon Sep 17 00:00:00 2001 From: Anton Volkov Date: Mon, 28 Jul 2025 13:55:41 +0200 Subject: [PATCH 1/4] Add GitHub workflow to autoupdate pre-commit --- .github/workflows/pre-commit-autoupdate.yml | 33 +++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 .github/workflows/pre-commit-autoupdate.yml diff --git a/.github/workflows/pre-commit-autoupdate.yml b/.github/workflows/pre-commit-autoupdate.yml new file mode 100644 index 000000000000..c5a151cd3bdf --- /dev/null +++ b/.github/workflows/pre-commit-autoupdate.yml @@ -0,0 +1,33 @@ +name: Autoupdate pre-Commit + +on: + # For Branch-Protection check. Only the default branch is supported. See + # https://github.com/ossf/scorecard/blob/main/docs/checks.md#branch-protection + branch_protection_rule: + # To guarantee Maintained check is occasionally updated. See + # https://github.com/ossf/scorecard/blob/main/docs/checks.md#maintained + schedule: + - cron: '28 2 * * 6' # Saturday at 02:28 UTC + workflow_dispatch: + +jobs: + autoupdate: + name: Autoupdate + + runs-on: ubuntu-latest + timeout-minutes: 10 + + steps: + - name: Checkout DPNP repo + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + + - name: Run pre-commit autoupdate + uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd # v3.0.1 + with: + args: autoupdate + + - name: Commit changes + uses: stefanzweifel/git-auto-commit-action@778341af668090896ca464160c2def5d1d1a3eb0 # v6.0.1 + with: + commit_message: 'chore: update pre-commit hooks' + file_pattern: .pre-commit-config.yaml From d7ddb7e1f841b8cea2955c85fc2c73337cb332f7 Mon Sep 17 00:00:00 2001 From: Anton Volkov Date: Mon, 28 Jul 2025 13:56:11 +0200 Subject: [PATCH 2/4] Remove CI block from pre-commit config --- .github/workflows/pre-commit-autoupdate.yml | 2 +- .pre-commit-config.yaml | 6 ------ 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/.github/workflows/pre-commit-autoupdate.yml b/.github/workflows/pre-commit-autoupdate.yml index c5a151cd3bdf..85f3af445752 100644 --- a/.github/workflows/pre-commit-autoupdate.yml +++ b/.github/workflows/pre-commit-autoupdate.yml @@ -1,4 +1,4 @@ -name: Autoupdate pre-Commit +name: Autoupdate pre-commit on: # For Branch-Protection check. Only the default branch is supported. See diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 033de2bb2aff..16f220cd171a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,9 +1,3 @@ -# See https://pre-commit.ci for more details -ci: - autofix_commit_msg: 'style: pre-commit fixes' - autoupdate_commit_msg: 'chore: update pre-commit hooks' - autoupdate_schedule: weekly - # See https://pre-commit.com for more information # See https://pre-commit.com/hooks.html for more hooks repos: From dbf5b984161465483777fda6359ad3c6b2a530e0 Mon Sep 17 00:00:00 2001 From: Anton Volkov Date: Mon, 28 Jul 2025 16:17:23 +0200 Subject: [PATCH 3/4] Run pre-commit autoupdate directly as a step --- .github/workflows/pre-commit-autoupdate.yml | 26 +++++++++++++++------ 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/.github/workflows/pre-commit-autoupdate.yml b/.github/workflows/pre-commit-autoupdate.yml index 85f3af445752..3d40adc8b78b 100644 --- a/.github/workflows/pre-commit-autoupdate.yml +++ b/.github/workflows/pre-commit-autoupdate.yml @@ -21,13 +21,25 @@ jobs: - name: Checkout DPNP repo uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - name: Run pre-commit autoupdate - uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd # v3.0.1 + - name: Set up python + uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0 with: - args: autoupdate + python-version: '3.13' + + - name: Install pre-commit + run: pip install pre-commit + + - name: Run pre-commit autoupdate + run: pre-commit autoupdate - - name: Commit changes - uses: stefanzweifel/git-auto-commit-action@778341af668090896ca464160c2def5d1d1a3eb0 # v6.0.1 + - name: Create a PR with autoupdate changes + uses: peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e #v7.0.8 with: - commit_message: 'chore: update pre-commit hooks' - file_pattern: .pre-commit-config.yaml + commit-message: 'chore: update pre-commit hooks' + add-paths: .pre-commit-config.yaml + branch: 'bot/pre-commit-autoupdate' + delete-branch: true + title: Weekly pre-commit autoupdate + body: | + This PR updates the `.pre-commit-config.yaml` using `pre-commit autoupdate`. + labels: autoupdate From b78d05b09a23ed83e4c05869bd7bb2f25ee99163 Mon Sep 17 00:00:00 2001 From: Anton Volkov Date: Mon, 28 Jul 2025 16:20:25 +0200 Subject: [PATCH 4/4] Add PR to the changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2acb9cd4a5eb..6d87aadd1824 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -31,6 +31,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 * Replaced the use of `numpy.testing.suppress_warnings` with appropriate calls from the warnings module [#2529](https://github.com/IntelPython/dpnp/pull/2529) * Improved documentations of `dpnp.ndarray` class and added a page with description of supported constants [#2422](https://github.com/IntelPython/dpnp/pull/2422) * Updated `dpnp.size` to accept tuple of ints for `axes` argument [#2536](https://github.com/IntelPython/dpnp/pull/2536) +* Replaced `ci` section in `.pre-commit-config.yaml` with a new GitHub workflow with scheduled run to autoupdate the `pre-commit` configuration [#2542](https://github.com/IntelPython/dpnp/pull/2542) ### Deprecated