Skip to content

Commit

Permalink
[TASK] Introduce pre commit hooks
Browse files Browse the repository at this point in the history
To remove trailing whitespace and let files end on one empty line.
  • Loading branch information
linawolf committed Aug 18, 2024
1 parent 114ab2c commit dd0cf52
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions .github/workflows/apply-precommit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,21 +27,17 @@ jobs:
- name: Run pre-commit hooks to fix issues
id: pre-commit
run: |
# Run pre-commit hooks
pre-commit run --all-files --hook-stage=manual || true
git config user.name "github-actions"
git config user.email "[email protected]"
# Stage all changes
git add .
# Check for changes
git status
git diff --cached
# Add and commit changes if there are any
if ! git diff --cached --quiet; then
git add .
git commit -m "Fix whitespace issues"
else
# Commit changes if there are any
if git diff --cached --quiet; then
echo "No changes to commit"
else
git commit -m "Fix whitespace issues" || echo "No changes to commit"
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down

0 comments on commit dd0cf52

Please sign in to comment.