Skip to content

Add CI/CD pipeline

Add CI/CD pipeline #6

Workflow file for this run

name: Pre-commit
on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main, develop ]
jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Cache pre-commit environments
uses: actions/cache@v4
with:
path: ~/.cache/pre-commit
key: pre-commit-${{ runner.os }}-${{ hashFiles('.pre-commit-config.yaml') }}
restore-keys: |
pre-commit-${{ runner.os }}-
- name: Install pre-commit
run: |
python -m pip install --upgrade pip
pip install pre-commit
- name: Run pre-commit on all files
run: |
pre-commit run --all-files --show-diff-on-failure --color=always
continue-on-error: true
- name: Comment PR on failure
if: failure() && github.event_name == 'pull_request'
uses: actions/github-script@v7
with:
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: '❌ Pre-commit checks failed. Please run `pre-commit run --all-files` locally and commit the changes.'
})