Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,37 @@ commands:
circleci step halt
}

run-precommit-on-changed-files:
steps:
- run:
name: Run pre-commit on changed files
command: |
# Check all
if [ "${CIRCLE_BRANCH}" = "main" ]; then
echo "On main branch - checking all files"
pip install pre-commit
pre-commit run --all-files
exit 0
fi

# Fetch branches
git fetch origin

# Find changed Python and Markdown files
CHANGED_FILES=$(git diff --name-only --diff-filter=ACMRT origin/main...HEAD | grep -E '\.(py|md)$' || true)

if [ -z "$CHANGED_FILES" ]; then
echo "No Python or Markdown files changed. Skipping pre-commit."
exit 0
fi

echo "Changed files:"
echo "$CHANGED_FILES"

# Run pre-commit on changed files
pip install pre-commit
echo "$CHANGED_FILES" | xargs pre-commit run --files

pip-install-deps:
steps:
- run:
Expand Down Expand Up @@ -155,6 +186,11 @@ jobs:
steps:
- checkout
- check-if-tests-needed
- when:
condition:
equal: [ "3.13", << parameters.py-version >> ]
steps:
- run-precommit-on-changed-files
- pip-install-deps
- pip-install-tests-deps
- run-tests-with-coverage-report
Expand Down
8 changes: 8 additions & 0 deletions sandbox/flask-app/sample.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import sys
import os

def calc( a,b ):
x = 10
return a+b

print( calc( 5,3 ) )
Loading