Skip to content

Test changes

Test changes #45

Workflow file for this run

name: Check and Fix Whitespace
on: [push, pull_request]
jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
ref: ${{ github.ref }}
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install pre-commit
run: pip install pre-commit
- name: Configure Git
run: |
git config user.name "github-actions"
git config user.email "[email protected]"
- name: Run pre-commit hooks to fix issues
id: pre-commit
run: |
pre-commit run --all-files --hook-stage=manual || true
git add .
if git diff --cached --quiet; then
echo "No changes to commit"
else
git commit -m "Fix whitespace issues" || echo "No changes to commit"
git push origin "${GITHUB_REF#refs/heads/}" || echo "Failed to push changes"
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Re-run workflow on push
if: github.event_name == 'push' && steps.pre-commit.outputs.changed == 'true'
run: |
curl -X POST \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/${{ github.repository }}/dispatches \
-d '{"event_type": "fix-whitespace"}'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Debug
run: |
echo "Git status:"
git status
echo "Git diff:"
git diff --cached