Skip to content

feat: make commit-check AI-native with JSON output and Python API #750

feat: make commit-check AI-native with JSON output and Python API

feat: make commit-check AI-native with JSON output and Python API #750

Workflow file for this run

name: main
on:
push:
branches:
- main
pull_request:
paths:
- "**.py"
- pyproject.toml
- ".github/workflows/main.yml"
- ".pre-commit-config.yaml"
- "!docs/**"
workflow_dispatch:
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: '3.x'
- name: Install nox
run: |
python -m pip install --upgrade pip
python -m pip install nox
- name: Run pre-commit
run: |
nox -s lint
nox -s test-hook
- name: Build wheel
run: nox -s build
- name: Upload wheel as artifact
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
with:
name: commit-check_wheel
path: ${{ github.workspace }}/dist/*.whl
- name: Run commit-check
run: nox -s commit-check
- name: Collect Coverage
run: nox -s coverage
- uses: codecov/codecov-action@5c47607acb93fed5485fdbf7232e8a31425f672a # v5.0.2
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage.xml
fail_ci_if_error: true # optional (default = false)
verbose: true # optional (default = false)
install:
needs: [build]
strategy:
fail-fast: false
matrix:
py: ['3.9', '3.10', '3.11', '3.12', '3.13', '3.14']
os: ['windows-latest', 'ubuntu-24.04', 'macos-latest']
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v6.0.2
- uses: actions/setup-python@v6.2.0
with:
python-version: ${{ matrix.py }}
- run: |
pip install --upgrade pip
pip install .[dev]
- name: Download wheel artifact
uses: actions/download-artifact@v8
with:
name: commit-check_wheel
path: dist
- name: Install test
# using a wildcard as filename on Windows requires a bash shell
shell: bash
run: nox -s install
docs:
runs-on: ubuntu-24.04
permissions:
contents: write
steps:
- uses: actions/checkout@v6.0.2
- uses: actions/setup-python@v6.2.0
with:
python-version: "3.10"
- name: Install nox
run: |
python -m pip install --upgrade pip
python -m pip install nox
- name: Build docs
run: nox -s docs
- name: Save built docs as artifact
uses: actions/upload-artifact@v7
with:
name: "commit-check_docs"
path: ${{ github.workspace }}/_build/html
- name: Upload docs to github pages
# only publish doc changes from main branch
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main'
uses: peaceiris/actions-gh-pages@4f9cc6602d3f66b9c108549d475ec49e8ef4d45e # v4.0.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./_build/html