@@ -33,38 +33,35 @@ jobs:
3333 env :
3434 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
3535 run : |
36+
3637 # Create a virtual environment
3738 python -m venv venv
3839 source venv/bin/activate
39-
40+
4041 # Upgrade pip and install pre-commit
4142 pip install --upgrade pip
4243 pip install -U pre-commit
43-
44+
4445 # Run pre-commit hooks to fix auto-fixable issues
4546 pre-commit install
46- pre-commit run --all-files --show-diff-on-failure > pre-commit.log 2>&1
47- exit_code=$?
48- cat pre-commit.log
49-
47+ pre-commit run --all-files | tee pre-commit.log 2>&1 || true
48+
5049 # Check if there are changes after pre-commit run
5150 if [ -n "$(git status --porcelain)" ]; then
5251 # Commit and push the changes if there are any
5352 git config user.name "GitHub Action"
5453 git config user.email "[email protected] " 5554 git remote set-url origin https://x-access-token:${GITHUB_TOKEN}@github.com/${{ github.repository }}.git
5655 git add -A
57- git commit -m -s "chore: apply pre-commit auto-fixes"
56+ git commit -n -s -m "chore: apply pre-commit auto-fixes"
5857 git push origin HEAD:${{ github.head_ref }}
5958 else
6059 # If no changes are made, print a message
6160 echo "No auto-fixable changes were made by pre-commit."
6261 fi
63-
64- # Exit with the original exit code from pre-commit
65- if [ $exit_code -ne 0 ]; then
66- echo "Pre-commit found issues. See pre-commit.log for details."
67- exit $exit_code
62+
63+ sleep 1s
64+ if [ $(grep -c "Failed" pre-commit.log) != 0 ]; then
65+ echo "Some checks failed that require manual intervention. Please review the pre-commit.log for details."
66+ exit 1
6867 fi
69-
70-
0 commit comments