aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/.github/workflows/prek.yml
diff options
context:
space:
mode:
Diffstat (limited to '.github/workflows/prek.yml')
-rw-r--r--.github/workflows/prek.yml60
1 files changed, 60 insertions, 0 deletions
diff --git a/.github/workflows/prek.yml b/.github/workflows/prek.yml
new file mode 100644
index 0000000..8e43763
--- /dev/null
+++ b/.github/workflows/prek.yml
@@ -0,0 +1,60 @@
+name: Prek Checks
+
+on:
+ push:
+ branches: ["main", "dev"]
+ workflow_dispatch:
+
+permissions:
+ contents: write
+
+jobs:
+ prek:
+ runs-on: ubuntu-latest
+ 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
+ id: prek
+ uses: j178/prek-action@v1
+ continue-on-error: true
+
+ - name: Check for changes
+ id: check_changes
+ if: steps.prek.outcome == 'failure'
+ run: |
+ if [ -n "$(git status --porcelain)" ]; then
+ echo "has_changes=true" >> $GITHUB_OUTPUT
+ else
+ echo "has_changes=false" >> $GITHUB_OUTPUT
+ fi
+
+ - name: Commit fixes
+ if: steps.prek.outcome == 'failure' && steps.check_changes.outputs.has_changes == 'true'
+ 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