forked from tim/k3s-ansible
5747bfce0e
- Update checkout, setup-python, cache, upload-artifact, and pin enforcement actions\n- Keep every third-party action pinned to an immutable release commit\n- Replace the deprecated cache action reference that blocked CI
55 lines
1.7 KiB
YAML
55 lines
1.7 KiB
YAML
---
|
|
name: Linting
|
|
on:
|
|
workflow_call:
|
|
jobs:
|
|
pre-commit-ci:
|
|
name: Pre-Commit
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
PYTHON_VERSION: "3.12"
|
|
|
|
steps:
|
|
- name: Check out the codebase
|
|
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # 7.0.1
|
|
with:
|
|
ref: ${{ github.event.pull_request.head.sha || github.sha }}
|
|
|
|
- name: Set up Python ${{ env.PYTHON_VERSION }}
|
|
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # 7.0.0
|
|
with:
|
|
python-version: ${{ env.PYTHON_VERSION }}
|
|
cache: 'pip' # caching pip dependencies
|
|
|
|
- name: Restore Ansible cache
|
|
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # 6.1.0
|
|
with:
|
|
path: ~/.ansible/collections
|
|
key: ansible-${{ hashFiles('collections/requirements.yml') }}
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
echo "::group::Upgrade pip"
|
|
python3 -m pip install --upgrade pip
|
|
echo "::endgroup::"
|
|
|
|
echo "::group::Install Python requirements from requirements.txt"
|
|
python3 -m pip install -r requirements.txt
|
|
echo "::endgroup::"
|
|
|
|
- name: Run pre-commit
|
|
uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd # 3.0.1
|
|
|
|
ensure-pinned-actions:
|
|
name: Ensure SHA Pinned Actions
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # 7.0.1
|
|
- name: Ensure SHA pinned actions
|
|
uses: zgosalvez/github-actions-ensure-sha-pinned-actions@3db98c0363e2fa5df3e1c4c471777a7c10b24cc9 # 5.0.5
|
|
with:
|
|
allowlist: |
|
|
aws-actions/
|
|
docker/login-action
|