-
Notifications
You must be signed in to change notification settings - Fork 0
47 lines (38 loc) · 1.08 KB
/
python_linter.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
47
name: X17-Surface Python Linter
# Controls when the action will run.
# Workflow runs when manually triggered using the UI, or when a push or pull request is made to the main branch
on:
push:
branches:
- main
pull_request:
branches:
- main
workflow_dispatch:
permissions:
contents: write # Grant write access to repository contents
jobs:
format:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Install Black
run: |
python -m pip install --upgrade pip
pip install black
- name: Run Black to format code
run: black .
- name: Commit changes
run: |
git config --local user.name "GitHub Action"
git config --local user.email "[email protected]"
git add .
git commit -m "Auto-format code using Black"
git push
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Use GitHub token for authentication