Files
semantica/.github/workflows/format.yml
T
KaifAhmad1 60f1b84d97 Simplify and fix GitHub workflows
- Simplify format.yml: check formatting on PRs, auto-format on push
- Remove duplicate formatting checks from ci.yml
- Simplify security.yml by removing unnecessary steps
- Add descriptive comments to all workflows
- Reduce workflow complexity by 50%+ while maintaining all features
2025-11-24 22:28:57 +05:30

50 lines
1.1 KiB
YAML

name: Format Code
# Ensures code follows consistent formatting style on every push and pull request
# Prevents unformatted code from being merged and keeps the codebase tidy automatically
on:
pull_request:
branches: [main, develop]
push:
branches: [main, develop]
workflow_dispatch:
permissions:
contents: write
pull-requests: write
jobs:
format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- run: |
pip install black isort
- name: Check formatting
if: github.event_name == 'pull_request'
run: |
black --check semantica/
isort --check-only semantica/
- name: Format code
if: github.event_name != 'pull_request'
run: |
black semantica/
isort semantica/
- name: Create PR
if: github.event_name != 'pull_request'
uses: peter-evans/create-pull-request@v5
with:
commit-message: "Auto-format code"
title: "Auto-format code"
branch: format/auto-format
delete-branch: true