trying again... #8
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: X17-Surface Linter | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
branches: | |
- master | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
# Install Python and dependencies | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.x' | |
# Install black | |
- name: Install Black | |
run: pip install black | |
# Run Black to auto-format code | |
- name: Run Black to reformat code | |
run: black . | |
# Check if there are any changes (if Black reformatted code) | |
- name: Check for code changes | |
run: | | |
git config --global user.name 'GitHub Actions' | |
git config --global user.email '[email protected]' | |
if [[ `git status --porcelain` ]]; then | |
git add . | |
git commit -m "Auto-format code using Black" | |
git push | |
else | |
echo "No code changes detected" |