Skip to content

Commit

Permalink
Optimize automatic prettier format using only commit and pre-commit hook
Browse files Browse the repository at this point in the history
  • Loading branch information
cavearr committed Feb 15, 2025
1 parent f8a5676 commit 9be848e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
21 changes: 13 additions & 8 deletions .github/workflows/prettier-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,22 @@ jobs:
- name: Install Dependencies
run: npm ci --legacy-peer-deps

- name: Run Prettier and JSHint
run: |
npm run prettier
npm run jshint
# If prettier or jshint fails, push or PR will be rejected
- name: Commit and Push Changes
- name: Commit and Push Changes with linting and auto-format
if: success()
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
# Intentar hacer commit
git add .
git commit -m "🚀 Auto-format code and linting check" || exit 0
git push
git commit -m "🚀 Auto-format code and linting check"
COMMIT_STATUS=$?
if [ $COMMIT_STATUS -eq 0 ]; then
echo "✅ Commit checks OK, continuing commiting"
git push
else
echo "❌ Commit with errors, aborting"
exit 1
fi
2 changes: 1 addition & 1 deletion app/scripts/services/graph.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//== JSHINT rules / START
/* global XXisClickOnVertex */
/* global isClickOnVertex */
//== JSHINT rules / END

//----------------------------------------------------------------------------
Expand Down

0 comments on commit 9be848e

Please sign in to comment.