Skip to content

Commit 1b7aa5d

Browse files
committed
[CI] Switch to prek-action workflow
Add a separate workflow for the manual hooks
1 parent 92e44bb commit 1b7aa5d

2 files changed

Lines changed: 47 additions & 20 deletions

File tree

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
name: pre-commit manual
19+
20+
on: [pull_request]
21+
22+
permissions:
23+
contents: read
24+
25+
concurrency:
26+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
27+
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
28+
29+
jobs:
30+
pre-commit:
31+
name: Run pre-commit
32+
runs-on: ubuntu-24.04
33+
steps:
34+
- name: 'Checkout ${{ github.ref }} ( ${{ github.sha }} )'
35+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
36+
with:
37+
persist-credentials: false
38+
- uses: j178/prek-action@44924fe9ef4a6f88253c4b6b1bf11c689d3ce53d # v3.1.0
39+
with:
40+
install-only: true
41+
- name: Run manual pre-commit hooks
42+
run: prek run --color=always --all-files --hook-stage manual

‎.github/workflows/pre-commit.yml‎

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -24,32 +24,17 @@ permissions:
2424

2525
concurrency:
2626
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
27-
cancel-in-progress: true
27+
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
2828

2929
jobs:
3030
pre-commit:
3131
name: Run pre-commit
3232
runs-on: ubuntu-24.04
3333
steps:
34-
- name: Check Out
35-
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
34+
- name: 'Checkout ${{ github.ref }} ( ${{ github.sha }} )'
35+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
3636
with:
3737
persist-credentials: false
38-
- name: Set up Python
39-
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
38+
- uses: j178/prek-action@44924fe9ef4a6f88253c4b6b1bf11c689d3ce53d # v3.1.0
4039
with:
41-
python-version: '3.11'
42-
cache: 'pip'
43-
- name: Install
44-
run: pip install pre-commit
45-
- name: Set PY
46-
run: echo "PY=$(python -VV | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV
47-
- name: Cache pre-commit environments
48-
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
49-
with:
50-
path: ~/.cache/pre-commit
51-
key: pre-commit|${{ env.PY }}|${{ hashFiles('.pre-commit-config.yaml') }}
52-
- name: Run pre-commit
53-
run: pre-commit run --color=always --all-files
54-
- name: Run manual pre-commit hooks
55-
run: pre-commit run --color=always --all-files --hook-stage manual
40+
extra-args: --all-files

0 commit comments

Comments
 (0)