Skip to content

Commit

Permalink
Merge pull request #116 from NiklasMelton/pre-commit-action
Browse files Browse the repository at this point in the history
pre-commit workflow
NiklasMelton authored Oct 22, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
2 parents c2a4ea5 + 5c831a4 commit fda24c8
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/pre_commit_checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Pre-commit checks

on:
pull_request:
push:
branches:
- develop
- main

jobs:
pre-commit:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.9' # Adjust this to your desired Python version

- name: Install Poetry
run: |
curl -sSL https://install.python-poetry.org | python3 -
- name: Install dependencies
run: |
poetry install --with dev
- name: Install pre-commit
run: |
poetry run pip install pre-commit
- name: Fetch the base branch
run: |
git fetch origin ${GITHUB_BASE_REF}:${GITHUB_BASE_REF}
env:
GITHUB_BASE_REF: ${{ github.event.pull_request.base.ref }}

- name: Run pre-commit on changed files
run: |
poetry run pre-commit run --from-ref origin/${GITHUB_BASE_REF} --to-ref HEAD
env:
GITHUB_BASE_REF: ${{ github.event.pull_request.base.ref }}

0 comments on commit fda24c8

Please sign in to comment.