aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/.github/workflows/prek.yml
blob: f002c8a4491267c6ce4b0f1477f5ecfb9a9e5072 (plain) (blame)
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
name: Prek Checks

on:
  push:
    branches: ["main", "dev"]
  workflow_dispatch:

permissions:
  contents: write

jobs:
  prek:
    runs-on: ubuntu-latest
    # Skip if commit message contains [skip ci] (to avoid loops with pre-commit.ci)
    if: "!contains(github.event.head_commit.message, '[skip ci]')"
    steps:
      - name: Checkout code
        uses: actions/checkout@v4
        with:
          token: ${{ secrets.GITHUB_TOKEN }}
          fetch-depth: 0
      
      - name: Install Rust
        uses: dtolnay/rust-toolchain@stable
      
      - name: Install system dependencies
        if: runner.os == 'Linux'
        run: |
          sudo apt-get update || true
          sudo apt-get install -y \
            libwebkit2gtk-4.1-dev \
            build-essential \
            libssl-dev \
            libgtk-3-dev \
            libayatana-appindicator3-dev \
            librsvg2-dev \
            pkg-config
      
      - name: Run prek (auto-fix)
        id: prek
        uses: j178/prek-action@v1
        continue-on-error: true
        with:
          all_files: true
      
      - name: Commit fixes
        if: steps.prek.outcome == 'failure'
        uses: stefanzweifel/git-auto-commit-action@v5
        with:
          commit_message: "chore: apply prek auto-fixes [skip ci]"
          commit_user_name: "hydroroll-bot"
          commit_user_email: "bot@hydroroll.team"
          skip_dirty_check: true