updated workflows #7
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: Format Code | |
on: | |
push: | |
branches: | |
- main # Change this to your main branch name | |
jobs: | |
format_python: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.8 # Change this to your Python version | |
- name: Install Python Dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install black | |
- name: Format Python Files | |
run: black . | |
- name: Commit and Push Python Changes | |
run: | | |
git config --local user.email "action@github.com" | |
git config --local user.name "GitHub Action" | |
git add . | |
git commit -m "Auto-format Python files with Black" | |
git push | |
format_html: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v2 | |
- name: Install Node.js and npm | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '14' | |
- name: Install Prettier | |
run: npm install -g prettier | |
- name: Format HTML Files | |
run: prettier --write "**/*.html" | |
- name: Commit and Push HTML Changes | |
run: | | |
git config --local user.email "action@github.com" | |
git config --local user.name "GitHub Action" | |
git add . | |
git commit -m "Auto-format HTML files with Prettier" | |
git push |