Skip to content

feat: Add action-ci, action-lint pipelines #1

feat: Add action-ci, action-lint pipelines

feat: Add action-ci, action-lint pipelines #1

Workflow file for this run

name: Lint Code Base
on:
pull_request:
branches:
- main
push:
jobs:
lint:
name: Lint Code Base
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: "3.12"
- name: Install Dependencies
run: pip install pre-commit
- uses: actions/cache@v3
with:
path: ~/.cache/pre-commit
key: pre-commit|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml') }}
- name: Lint Code Base
run: |
pre-commit run \
--color always \
--show-diff-on-failure \
--from-ref $GITHUB_FROM_SHA \
--to-ref $GITHUB_TO_SHA
env:
GITHUB_FROM_SHA: ${{ github.event_name == 'push' && github.event.before || github.event.pull_request.base.sha }}
GITHUB_TO_SHA: ${{ github.event_name == 'push' && github.event.after || github.event.pull_request.head.sha }}