This is an automated email from the ASF dual-hosted git repository.
lprimak pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/shiro.git
The following commit(s) were added to refs/heads/main by this push:
new f3e897f83 [CI] Create reusable pre-commit workflows (#2635)
f3e897f83 is described below
commit f3e897f83ef9c64a1ed63585a1a85598d3a33759
Author: John Bampton <[email protected]>
AuthorDate: Sun Mar 22 04:06:39 2026 +1000
[CI] Create reusable pre-commit workflows (#2635)
---
.../{pre-commit.yml => pre-commit-reusable.yml} | 34 ++++++++--------
.github/workflows/pre-commit.yml | 47 ++++++----------------
2 files changed, 30 insertions(+), 51 deletions(-)
diff --git a/.github/workflows/pre-commit.yml
b/.github/workflows/pre-commit-reusable.yml
similarity index 77%
copy from .github/workflows/pre-commit.yml
copy to .github/workflows/pre-commit-reusable.yml
index b86803454..e9e987251 100644
--- a/.github/workflows/pre-commit.yml
+++ b/.github/workflows/pre-commit-reusable.yml
@@ -16,31 +16,35 @@
# under the License.
---
-name: pre-commit
+name: _pre-commit-base
-on: [pull_request]
+on:
+ 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@de0fac2e4500dabe0009e67214ff5f5447ce83dd #
v6.0.2
with:
persist-credentials: false
- - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 #
6.2.0
+ - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 #
v6.2.0
with:
- python-version: '3.14.1' # 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.14.1'
+ architecture: 'x64'
+ - name: Install dependencies
run: |
echo "pre-commit==4.5.0
--hash=sha256:25e2ce09595174d9c97860a95609f9f852c0614ba602de3561e267547f2335e1
cfgv==3.5.0
--hash=sha256:a8dc6b26ad22ff227d2634a65cb388215ce6cc96bbcc5cfde7641ae87e8dacc0
@@ -58,8 +62,6 @@ jobs:
- 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
- - name: Run manual pre-commit hooks
- run: pre-commit run --color=always --all-files --hook-stage manual
--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 b86803454..3e0bdc8b8 100644
--- a/.github/workflows/pre-commit.yml
+++ b/.github/workflows/pre-commit.yml
@@ -28,38 +28,15 @@ 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@de0fac2e4500dabe0009e67214ff5f5447ce83dd #
v6.0.2
- with:
- persist-credentials: false
- - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 #
6.2.0
- with:
- python-version: '3.14.1' # 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: |
- echo "pre-commit==4.5.0
--hash=sha256:25e2ce09595174d9c97860a95609f9f852c0614ba602de3561e267547f2335e1
- cfgv==3.5.0
--hash=sha256:a8dc6b26ad22ff227d2634a65cb388215ce6cc96bbcc5cfde7641ae87e8dacc0
- identify==2.6.1
--hash=sha256:53863bcac7caf8d2ed85bd20312ea5dcfc22226800f6d6881f232d861db5a8f0
- nodeenv==1.9.1
--hash=sha256:ba11c9782d29c27c70ffbdda2d7415098754709be8a7056d79a737cd901155c9
- pyyaml==6.0.3
--hash=sha256:c458b6d084f9b935061bc36216e8a69a7e293a2f1e68bf956dcd9e6cbcd143f5
- virtualenv==20.35.4
--hash=sha256:c21c9cede36c9753eeade68ba7d523529f228a403463376cf821eaae2b650f1b
- distlib==0.4.0
--hash=sha256:9659f7d87e46584a30b5780e43ac7a2143098441670ff0a49d5f9034c54a6c16
- filelock==3.20.0
--hash=sha256:339b4732ffda5cd79b13f4e2711a31b0365ce445d95d243bb996273d072546a2
- platformdirs==4.5.0
--hash=sha256:e578a81bb873cbb89a41fcc904c7ef523cc18284b7e3b3ccf06aca1403b7ebd3"
\
- > pre-commit-requirements.txt
- pip install --require-hashes -r pre-commit-requirements.txt
- - name: set PY
- 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') }}
- - name: Run pre-commit
- run: pre-commit run --color=always --all-files --show-diff-on-failure
- - name: Run manual pre-commit hooks
- run: pre-commit run --color=always --all-files --hook-stage manual
--show-diff-on-failure
+ standard:
+ name: Run pre-commit
+ uses: ./.github/workflows/pre-commit-reusable.yml
+ with:
+ job_id: "standard"
+
+ manual:
+ name: Run manual pre-commit hooks
+ uses: ./.github/workflows/pre-commit-reusable.yml
+ with:
+ job_id: "manual"
+ extra_args: "--hook-stage manual"