-
Notifications
You must be signed in to change notification settings - Fork 9k
105 lines (91 loc) · 3.42 KB
/
py_autofix.yml
File metadata and controls
105 lines (91 loc) · 3.42 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
101
102
103
104
105
name: autofix.ci
on:
pull_request:
paths:
- "**/*.py"
- "src/lfx/src/lfx/components/**"
- "scripts/build_component_index.py"
types: [opened, synchronize, reopened, labeled]
env:
PYTHON_VERSION: "3.13"
jobs:
lint:
name: Run Ruff Check and Format
if: github.event.action != 'labeled' && github.actor != 'github-actions[bot]'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: "Setup Environment"
uses: astral-sh/setup-uv@v6
with:
enable-cache: true
cache-dependency-glob: "uv.lock"
python-version: ${{ env.PYTHON_VERSION }}
prune-cache: false
- run: uv run ruff check --fix-only .
- run: uv run ruff format . --config pyproject.toml
- uses: autofix-ci/action@635ffb0c9798bd160680f18fd73371e355b85f27
update-starter-projects:
name: Update Starter Projects
if: github.event.action != 'labeled' && github.actor != 'github-actions[bot]'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: "Setup Environment"
uses: astral-sh/setup-uv@v6
with:
enable-cache: true
cache-dependency-glob: "uv.lock"
python-version: ${{ env.PYTHON_VERSION }}
prune-cache: false
- name: "Install dependencies"
run: |
uv sync
uv pip install -e .
- name: Run starter projects update
run: uv run python scripts/ci/update_starter_projects.py
- uses: autofix-ci/action@635ffb0c9798bd160680f18fd73371e355b85f27
update-component-index:
name: Update Component Index
if: >-
github.actor != 'github-actions[bot]'
&& (github.event.action != 'labeled' || github.event.label.name == 'fix-index')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.event.pull_request.head.ref }}
fetch-depth: 0
- name: Merge base branch
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git merge origin/${{ github.base_ref }} --no-edit || {
# Check which files have conflicts
CONFLICTED=$(git diff --name-only --diff-filter=U)
# If any non-generated files conflict, bail out — needs manual resolution
if echo "$CONFLICTED" | grep -v component_index.json | grep -q .; then
echo "::error::Merge conflicts in non-generated files require manual resolution"
git merge --abort
exit 1
fi
# Only component_index.json conflicts — resolve and finish merge
git checkout --theirs src/lfx/src/lfx/_assets/component_index.json
git add src/lfx/src/lfx/_assets/component_index.json
GIT_EDITOR=true git merge --continue
}
- name: "Setup Environment"
uses: astral-sh/setup-uv@v6
with:
enable-cache: true
cache-dependency-glob: "uv.lock"
python-version: ${{ env.PYTHON_VERSION }}
prune-cache: false
- name: "Install dependencies"
run: uv sync --dev --project .
- name: Build component index
env:
LFX_DEV: "1"
run: make build_component_index
- uses: autofix-ci/action@635ffb0c9798bd160680f18fd73371e355b85f27