fix: modify format.yml to skip README-only changes

- Add paths-ignore filter to skip README.md and documentation files
- Update README.md to remove non-existent external documentation links
- Add cookbook links pointing to GitHub repository
This commit is contained in:
KaifAhmad1
2025-11-25 16:26:37 +05:30
parent 3741976ceb
commit df4b9d1b8e
+56 -41
View File
@@ -1,49 +1,64 @@
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
name: Format Check
on:
pull_request:
branches: [main, develop]
push:
branches: [main, develop]
workflow_dispatch:
permissions:
contents: write
pull-requests: write
branches: [ main, master, develop ]
paths-ignore:
- 'README.md'
- '*.md'
- 'docs/**'
- 'CHANGELOG.md'
- 'CONTRIBUTING.md'
- 'CODE_OF_CONDUCT.md'
- 'CONTRIBUTORS.md'
- 'SECURITY.md'
- 'SUPPORT.md'
- 'LICENSE'
- 'cookbook/**/*.md'
pull_request:
branches: [ main, master, develop ]
paths-ignore:
- 'README.md'
- '*.md'
- 'docs/**'
- 'CHANGELOG.md'
- 'CONTRIBUTING.md'
- 'CODE_OF_CONDUCT.md'
- 'CONTRIBUTORS.md'
- 'SECURITY.md'
- 'SUPPORT.md'
- 'LICENSE'
- 'cookbook/**/*.md'
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
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install black isort flake8 mypy
- name: Run Black
run: |
black --check --diff semantica/
- name: Run isort
run: |
isort --check-only --diff semantica/
- name: Run flake8
run: |
flake8 semantica/ --max-line-length=88 --extend-ignore=E203,W503
- name: Run mypy
run: |
mypy semantica/ || true