-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Loading status checks…
Merge pull request #116 from NiklasMelton/pre-commit-action
pre-commit workflow
Showing
1 changed file
with
45 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} |