Repository navigation
100 lines (83 loc) · 2.69 KB
/
Copy pathautofix.yml
File metadata and controls
100 lines (83 loc) · 2.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
name: 🤖 Auto-fix (Ruff)
on:
pull_request:
branches: [main, development]
types: [opened, synchronize, reopened]
workflow_dispatch:
permissions:
contents: write
pull-requests: write
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: "true"
PYTHON_VERSION: "3.12"
jobs:
autofix:
name: 🔧 Auto Fix Lint & Format
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
# 📥 Checkout PR branch (fixes detached HEAD issue)
- name: 📦 Checkout repository
uses: actions/checkout@v6
with:
ref: ${{ github.head_ref }}
fetch-depth: 0
# 🐍 Setup Python (with cache)
- name: 🐍 Setup Python
uses: actions/setup-python@v6
with:
python-version: ${{ env.PYTHON_VERSION }}
cache: "pip"
# ⚡ Setup uv (fast package manager)
- name: ⚡ Setup uv
uses: astral-sh/setup-uv@v7
# 📦 Install dependencies
- name: 📦 Install dependencies
run: |
uv sync --all-extras --dev
# 🔍 Run Ruff auto-fix
- name: 🔍 Ruff Auto Fix
run: |
uv run ruff check src/ctxai tests --fix
# 🎨 Format code
- name: 🎨 Ruff Format
run: |
uv run ruff format src/ctxai tests
# 🧠 Detect changes (important optimization)
- name: 🧠 Detect changes
id: diff
run: |
if git diff --quiet; then
echo "changed=false" >> $GITHUB_OUTPUT
else
echo "changed=true" >> $GITHUB_OUTPUT
fi
# 🚀 Create PR only if changes exist
- name: 🚀 Create Pull Request
if: steps.diff.outputs.changed == 'true'
uses: peter-evans/create-pull-request@v8
with:
commit-message: "style(ctxai): auto-fix linting issues"
title: "🤖 Auto-fix: Ruff lint & format सुधार"
body: |
## 🤖 Automated Code Fixes (CtxAi)
This PR was automatically generated to improve code quality.
### ✅ Fixes Applied
- 🎨 Code formatting (ruff format)
- 📦 Import sorting & cleanup
- 🔍 Lint issue fixes
### ⚙️ Tooling
- Ruff (lint + formatter)
- uv (fast dependency manager)
---
💡 This PR is auto-generated by the CtxAi CI system.
branch: autofix/linting
base: ${{ github.head_ref }}
delete-branch: true
labels: |
automated
autofix
# 💤 Skip message (useful for debugging)
- name: 💤 No changes
if: steps.diff.outputs.changed == 'false'
run: echo "✅ No linting changes needed"