-
Notifications
You must be signed in to change notification settings - Fork 5.7k
50 lines (42 loc) · 1.33 KB
/
lint.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
48
49
50
name: lint
on:
workflow_dispatch:
schedule:
- cron: "0 4 * * *"
permissions:
contents: write
jobs:
lint-code:
runs-on: ubuntu-latest
steps:
- name: Checkout ${{ github.event.repository.name }}
uses: actions/checkout@v4
- name: Get changed files
if: github.event_name == 'pull_request'
id: changed-files
uses: lots0logs/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.10.14
- name: Run pre-commit
continue-on-error: true
uses: pre-commit/[email protected]
with:
extra_args: ${{ github.event_name == 'pull_request' && format('--files {0}', join(fromJSON(steps.changed-files.outputs.all), ' ')) || '--all-files' }}
- name: Check if there are changes
id: check
run: |
if [[ -n "$(git status --porcelain)" ]]; then
echo "changes=true" >> $GITHUB_OUTPUT
fi
- name: Commit changes
if: steps.check.outputs.changes == 'true'
run: |
git config --local user.email "[email protected]"
git config --local user.name "ivy-dev-bot"
git add .
git commit -m "auto-lint code"
git push