diff options
| author | 2026-01-18 12:24:29 +0800 | |
|---|---|---|
| committer | 2026-01-18 12:24:29 +0800 | |
| commit | fd00ac6878b2cee9337b9e92d0c990ecdce9a346 (patch) | |
| tree | bb5540f763dc0061877c9d9ac53747d79193eecc /.github/workflows/prek.yml | |
| parent | ad36e0ce82770f9b3509ddb1cf96bc3422969806 (diff) | |
| parent | 6d82ab2275130f3bafdb7ec664297eb700321526 (diff) | |
| download | DropOut-fd00ac6878b2cee9337b9e92d0c990ecdce9a346.tar.gz DropOut-fd00ac6878b2cee9337b9e92d0c990ecdce9a346.zip | |
Merge pull request #58 from HsiangNianian/main
Diffstat (limited to '.github/workflows/prek.yml')
| -rw-r--r-- | .github/workflows/prek.yml | 60 |
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 |