Skip to content

Commit

Permalink
enhane(workflow): added cli directory
Browse files Browse the repository at this point in the history
  • Loading branch information
ashrafchowdury committed Dec 10, 2024
1 parent a03962a commit f1f3548
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 2 deletions.
18 changes: 17 additions & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Check if there are staged changes in the frontend directory
# Check for changes in frontend directory
if git diff --cached --name-only | grep -q '^agenta-web/'; then
cd agenta-web || exit

Expand All @@ -18,6 +18,22 @@ fi
if git diff --cached --name-only | grep -q '^agenta-backend/'; then
cd agenta-backend || exit

# Run black for formatting
if ! black --check .; then
echo '⚠️ Formatting issues detected. Running black to fix them...'
black .

# Stage the fixed files
git add .

echo '✅ Formatting issues fixed and changes staged.'
fi
fi

# Check for changes in cli directory
if git diff --cached --name-only | grep -q '^agenta-cli/'; then
cd agenta-cli || exit

# Run black for formatting
if ! black --check .; then
echo '⚠️ Formatting issues detected. Running black to fix them...'
Expand Down
15 changes: 14 additions & 1 deletion .husky/pre-push
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,20 @@ if git diff --name-only --cached origin/$(git rev-parse --abbrev-ref HEAD) | gre
cd agenta-backend || exit

# Run backend checks
if ! pylint $(git diff --cached --name-only | grep '\.py$'); then
if ! pylint --recursive=y --errors-only .; then
echo '❌ pylint issues detected. Please fix them before pushing the code.'
exit 1
fi

echo '🎉 Backend checks passed. Ready to push!'
fi

# Check cli changes
if git diff --name-only --cached origin/$(git rev-parse --abbrev-ref HEAD) | grep -q '^agenta-cli/'; then
cd agenta-cli || exit

# Run backend checks
if ! pylint --recursive=y --errors-only .; then
echo '❌ pylint issues detected. Please fix them before pushing the code.'
exit 1
fi
Expand Down

0 comments on commit f1f3548

Please sign in to comment.