Skip to content

Format Code via Ruff #1

Format Code via Ruff

Format Code via Ruff #1

Workflow file for this run

name: Format Code via Ruff
on:
workflow_dispatch:
inputs:
branch:
description: 'Branch to format'
required: true
default: 'master'
type: string
jobs:
code-format:
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.branch }}
- name: Set up Python3
uses: actions/setup-python@v4
- name: Install Ruff Linter
run: pip install ruff
- name: Run Ruff to Format Code
run: |
ruff check . --exit-zero
ruff format .
git add -u
- name: Commit and Push Changes
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
if git diff-index --quiet HEAD --; then
echo "No changes to commit."
else
git commit -m "style: Auto Ruff Formatter"
git push origin HEAD:${{ github.event.inputs.branch }}
fi