mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Add setup-pre-commit
action
Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
This commit is contained in:
parent
131028f67d
commit
e2b45b1a5e
1 changed files with 48 additions and 0 deletions
48
.github/actions/setup-pre-commit/action.yml
vendored
Normal file
48
.github/actions/setup-pre-commit/action.yml
vendored
Normal file
|
@ -0,0 +1,48 @@
|
|||
---
|
||||
name: setup-pre-commit
|
||||
description: Setup 'pre-commit'
|
||||
|
||||
inputs:
|
||||
version:
|
||||
type: string
|
||||
description: Pre-commit version to install
|
||||
required: true
|
||||
default: 3.0.3
|
||||
cache-seed:
|
||||
required: true
|
||||
type: string
|
||||
description: Seed used to invalidate caches
|
||||
|
||||
env:
|
||||
PIP_INDEX_URL: https://pypi-proxy.saltstack.net/root/local/+simple/
|
||||
PIP_EXTRA_INDEX_URL: https://pypi.org/simple
|
||||
|
||||
|
||||
runs:
|
||||
using: composite
|
||||
|
||||
steps:
|
||||
|
||||
- uses: ./.github/actions/cached-virtualenv
|
||||
id: pre-commit-virtualenv
|
||||
with:
|
||||
name: pre-commit
|
||||
cache-seed: ${{ inputs.cache-seed }}
|
||||
|
||||
- name: Install Pre-Commit
|
||||
if: ${{ steps.pre-commit-virtualenv.outputs.cache-hit != 'true' }}
|
||||
shell: bash
|
||||
run: |
|
||||
${{ steps.pre-commit-virtualenv.outputs.python-executable }} -m pip install pre-commit==${{ inputs.version }}
|
||||
|
||||
- name: Cache Pre-Commit Hooks
|
||||
uses: actions/cache@v3
|
||||
id: pre-commit-hooks-cache
|
||||
with:
|
||||
key: ${{ steps.pre-commit-virtualenv.outputs.cache-key }}|${{ inputs.version }}|${{ hashFiles('.pre-commit-config.yaml') }}
|
||||
path: ~/.cache/pre-commit
|
||||
|
||||
- name: Install Pre-Commit Hooks
|
||||
shell: bash
|
||||
run: |
|
||||
pre-commit install --install-hooks
|
Loading…
Add table
Reference in a new issue