-
Notifications
You must be signed in to change notification settings - Fork 83
46 lines (39 loc) · 1.35 KB
/
ci_cd.yml
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
name: Simba CI
on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main, develop ]
workflow_dispatch: # Allows manual triggering from GitHub UI
jobs:
lint-and-format:
name: Lint and Format
runs-on: ubuntu-latest
# Add job-level permissions
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
# Required to push back formatting changes
token: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.12'
- name: Install Nox
run: pip install nox "nox[uv]" uv
# First run the formatter
- name: Format code
run: nox -s format
# Then run linting to check for any issues that weren't auto-fixed
- name: Lint code
run: nox -s lint || echo "Linting issues found, but continuing"
# Commit formatting changes if running on push to main/develop
- name: Commit format changes
if: github.event_name == 'push'
run: |
git config --local user.email "simba[bot]@users.noreply.github.com"
git config --local user.name "Simba Bot"
git diff --quiet || (git add . && git commit -m "🎨 Auto-format code [skip ci]" && git push)