This is an automated email from the ASF dual-hosted git repository.

jiayu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sedona.git


The following commit(s) were added to refs/heads/master by this push:
     new 8d059b412e [CI] Create reusable pre-commit workflows (#2759)
8d059b412e is described below

commit 8d059b412ea68bfce548a49a8de23395b2a31a6a
Author: John Bampton <[email protected]>
AuthorDate: Wed Mar 18 15:52:38 2026 +1000

    [CI] Create reusable pre-commit workflows (#2759)
---
 .github/CODEOWNERS                                 |  1 +
 .github/workflows/pre-commit-manual.yml            | 32 ++++-------------
 .../{pre-commit.yml => pre-commit-reusable.yml}    | 42 +++++++++++-----------
 .github/workflows/pre-commit.yml                   | 27 +++-----------
 4 files changed, 32 insertions(+), 70 deletions(-)

diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS
index 2bbb318d83..585374810c 100644
--- a/.github/CODEOWNERS
+++ b/.github/CODEOWNERS
@@ -20,6 +20,7 @@
 /.github/workflows/license-templates/LICENSE.txt    @jbampton @jiayuasu
 /.github/workflows/pre-commit.yml                   @jbampton @jiayuasu
 /.github/workflows/pre-commit-manual.yml            @jbampton @jiayuasu
+/.github/workflows/pre-commit-reusable.yml          @jbampton @jiayuasu
 /.github/dependabot.yml                             @jbampton @jiayuasu
 /python/sedona/doc/checkmake.ini                    @jbampton @jiayuasu
 /python/sedona/doc/Makefile                         @jbampton @jiayuasu
diff --git a/.github/workflows/pre-commit-manual.yml 
b/.github/workflows/pre-commit-manual.yml
index 29011c3be5..a7b63ab54d 100644
--- a/.github/workflows/pre-commit-manual.yml
+++ b/.github/workflows/pre-commit-manual.yml
@@ -15,7 +15,7 @@
 # specific language governing permissions and limitations
 # under the License.
 
-name: Manual hooks
+name: pre-commit-manual
 
 on:
   push:
@@ -33,27 +33,9 @@ concurrency:
   cancel-in-progress: ${{ github.ref != 'refs/heads/master' }}
 
 jobs:
-  pre-commit:
-    name: Run pre-commit # https://pre-commit.com/
-    runs-on: ubuntu-latest
-    steps:
-      - name: 'Checkout ${{ github.ref }} ( ${{ github.sha }} )'
-        uses: actions/checkout@v6
-        with:
-          persist-credentials: false
-      - uses: actions/setup-python@v6 # https://www.python.org/
-        with:
-          python-version: '3.11' # Version range or exact version of a Python 
version to use, using SemVer's version range syntax
-          architecture: 'x64' # optional x64 or x86. Defaults to x64 if not 
specified
-      - name: Install dependencies # https://pip.pypa.io/en/stable/
-        run: |
-          python -m pip install --upgrade pip
-          pip install pre-commit
-      - name: set PY
-        run: echo "PY=$(python -VV | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV
-      - uses: actions/cache@v5
-        with:
-          path: ~/.cache/pre-commit
-          key: pre-commit-manual|${{ env.PY }}|${{ 
hashFiles('.pre-commit-config.yaml') }}
-      - name: Run manual pre-commit hooks
-        run: pre-commit run --color=always --all-files --hook-stage manual 
--show-diff-on-failure
+  run:
+    name: Run manual hooks
+    uses: ./.github/workflows/pre-commit-reusable.yml
+    with:
+      job_id: 'manual'
+      extra_args: '--hook-stage manual'
diff --git a/.github/workflows/pre-commit.yml 
b/.github/workflows/pre-commit-reusable.yml
similarity index 61%
copy from .github/workflows/pre-commit.yml
copy to .github/workflows/pre-commit-reusable.yml
index 0655826711..c66f40ee04 100644
--- a/.github/workflows/pre-commit.yml
+++ b/.github/workflows/pre-commit-reusable.yml
@@ -15,45 +15,43 @@
 # specific language governing permissions and limitations
 # under the License.
 
-name: pre-commit
+name: _pre-commit-base
 
 on:
-  push:
-    branches:
-      - master
-  pull_request:
-    branches:
-      - '*'
+  workflow_call:
+    inputs:
+      extra_args:
+        required: false
+        type: string
+        default: ''
+      job_id:
+        required: true
+        type: string
 
 permissions:
   contents: read
 
-concurrency:
-  group: ${{ github.workflow }}-${{ github.ref }}
-  cancel-in-progress: ${{ github.ref != 'refs/heads/master' }}
-
 jobs:
-  pre-commit:
-    name: Run pre-commit # https://pre-commit.com/
+  run-hooks:
     runs-on: ubuntu-latest
     steps:
       - name: 'Checkout ${{ github.ref }} ( ${{ github.sha }} )'
-        uses: actions/checkout@v6
+        uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # 
v6.0.2
         with:
           persist-credentials: false
-      - uses: actions/setup-python@v6 # https://www.python.org/
+      - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # 
v6.2.0
         with:
-          python-version: '3.11' # Version range or exact version of a Python 
version to use, using SemVer's version range syntax
-          architecture: 'x64' # optional x64 or x86. Defaults to x64 if not 
specified
-      - name: Install dependencies # https://pip.pypa.io/en/stable/
+          python-version: '3.11'
+          architecture: 'x64'
+      - name: Install dependencies
         run: |
           python -m pip install --upgrade pip
           pip install pre-commit
       - name: set PY
-        run: echo "PY=$(python -VV | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV
-      - uses: actions/cache@v5
+        run: echo "PY=$(python -VV | sha256sum | cut -d' ' -f1)" >> 
"$GITHUB_ENV"
+      - uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3
         with:
           path: ~/.cache/pre-commit
-          key: pre-commit|${{ env.PY }}|${{ 
hashFiles('.pre-commit-config.yaml') }}
+          key: pre-commit|${{ inputs.job_id }}|${{ env.PY }}|${{ 
hashFiles('.pre-commit-config.yaml') }}
       - name: Run pre-commit
-        run: pre-commit run --color=always --all-files --show-diff-on-failure
+        run: pre-commit run --color=always --all-files --show-diff-on-failure 
${{ inputs.extra_args }} # zizmor: ignore[template-injection]
diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml
index 0655826711..2bf524f421 100644
--- a/.github/workflows/pre-commit.yml
+++ b/.github/workflows/pre-commit.yml
@@ -34,26 +34,7 @@ concurrency:
 
 jobs:
   pre-commit:
-    name: Run pre-commit # https://pre-commit.com/
-    runs-on: ubuntu-latest
-    steps:
-      - name: 'Checkout ${{ github.ref }} ( ${{ github.sha }} )'
-        uses: actions/checkout@v6
-        with:
-          persist-credentials: false
-      - uses: actions/setup-python@v6 # https://www.python.org/
-        with:
-          python-version: '3.11' # Version range or exact version of a Python 
version to use, using SemVer's version range syntax
-          architecture: 'x64' # optional x64 or x86. Defaults to x64 if not 
specified
-      - name: Install dependencies # https://pip.pypa.io/en/stable/
-        run: |
-          python -m pip install --upgrade pip
-          pip install pre-commit
-      - name: set PY
-        run: echo "PY=$(python -VV | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV
-      - uses: actions/cache@v5
-        with:
-          path: ~/.cache/pre-commit
-          key: pre-commit|${{ env.PY }}|${{ 
hashFiles('.pre-commit-config.yaml') }}
-      - name: Run pre-commit
-        run: pre-commit run --color=always --all-files --show-diff-on-failure
+    name: Run pre-commit standard
+    uses: ./.github/workflows/pre-commit-reusable.yml
+    with:
+      job_id: 'standard'

Reply via email to