-
-
Notifications
You must be signed in to change notification settings - Fork 6
54 lines (46 loc) · 1.36 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
51
52
53
54
# Lint code and (optionally) apply fixes
name: Lint code
on:
pull_request:
push:
branches: [main]
schedule:
- cron: 0 0 * * 1 # Every monday
workflow_dispatch:
jobs:
auto-update:
runs-on: ubuntu-latest
if: ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }}
permissions:
contents: write
pull-requests: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install pre-commit
run: pip install pre-commit
- name: Run autoupdate
run: pre-commit autoupdate
- name: Create a pull request with updated versions
uses: peter-evans/create-pull-request@v6
with:
branch: update/pre-commit-hooks
title: 'chore(deps): update pre-commit hooks'
commit-message: 'chore(deps): update pre-commit hooks'
pre-commit:
runs-on: ubuntu-latest
if: ${{ github.event_name != 'schedule' }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Rust nightly
uses: dtolnay/rust-toolchain@nightly
with:
components: clippy,rustfmt
- name: Run pre-commit hooks
uses: pre-commit/[email protected]
- name: Apply fixes when present
uses: pre-commit-ci/[email protected]
if: always()
with:
msg: 'chore(fmt): auto fixes from pre-commit hooks'