Skip to content

Commit

Permalink
Check precommit
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelKora committed Nov 29, 2023
1 parent c3ddc82 commit 089a560
Showing 1 changed file with 31 additions and 5 deletions.
36 changes: 31 additions & 5 deletions .github/workflows/_pre-commit-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,37 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: Check if Pre-Commit Ran Locally
# - name: Check if Pre-Commit Ran Locally
# run: |
# if [ -f .git/COMMIT_EDITMSG ]; then
# echo "Pre-Commit were not run locally. Please run 'pre-commit run --all-files' locally before committing."
# exit 1
# else
# echo "Pre-Commit were run locally. Proceeding with the workflow."
# fi
- name: Checkout code
uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.8

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pre-commit
- name: Check if pre-commit ran locally
run: |
if [ -f .git/COMMIT_EDITMSG ]; then
echo "Pre-Commit were not run locally. Please run 'pre-commit run --all-files' locally before committing."
exit 1
if git rev-parse --verify HEAD >/dev/null 2>&1; then
echo "Checking if pre-commit ran locally..."
if [ -f .pre_commit_ran ]; then
echo "Pre-commit checks were run locally."
else
echo "Pre-commit checks were not run locally. Please run 'pre-commit run --all-files' before pushing."
exit 1
fi
else
echo "Pre-Commit were run locally. Proceeding with the workflow."
echo "This is not a push to a branch. Skipping pre-commit check."
fi

0 comments on commit 089a560

Please sign in to comment.