diff --git a/.github/workflows/prek_update.yml b/.github/workflows/prek_update.yml new file mode 100644 index 00000000..565bc962 --- /dev/null +++ b/.github/workflows/prek_update.yml @@ -0,0 +1,30 @@ +name: Prek Auto Update + +on: + schedule: + - cron: "0 2 * * *" + workflow_dispatch: +permissions: + contents: write + pull-requests: write +jobs: + update: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v7 + - name: Install prek + run: curl --proto '=https' --tlsv1.2 -LsSf https://github.com/j178/prek/releases/download/v0.4.10/prek-installer.sh | sh + - name: Run Update + run: prek autoupdate + - name: Create Pull Request + uses: peter-evans/create-pull-request@v8 + with: + token: ${{ secrets.PREK_UPDATE_TOKEN }} + commit-message: "Bump prek hooks" + branch: prek-autoupdate + delete-branch: true + title: "Bump prek hooks" + body: "Automated update of prek hooks via `prek autoupdate`." + labels: | + dependencies + skip-changelog diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index d9077058..de831dbe 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -52,6 +52,13 @@ jobs: uses: Swatinem/rust-cache@v2.9.1 - name: Run cargo fmt run: cargo fmt --all -- --check + prek: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v7 + - uses: j178/prek-action@v2 + env: + SKIP: no-commit-to-branch test: name: Tests strategy: diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml deleted file mode 100644 index d13c64c2..00000000 --- a/.pre-commit-config.yaml +++ /dev/null @@ -1,16 +0,0 @@ -ci: - skip: [fmt] - -repos: - - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v6.0.0 - hooks: - - id: check-added-large-files - - id: check-toml - - id: check-yaml - - id: end-of-file-fixer - - id: trailing-whitespace - - repo: https://github.com/doublify/pre-commit-rust - rev: v1.0 - hooks: - - id: fmt diff --git a/prek.toml b/prek.toml new file mode 100644 index 00000000..7a95f1f7 --- /dev/null +++ b/prek.toml @@ -0,0 +1,17 @@ +[[repos]] +repo = "builtin" +hooks = [ + { id = "check-added-large-files" }, + { id = "check-toml" }, + { id = "check-yaml" }, + { id = "end-of-file-fixer" }, + { id = "no-commit-to-branch" }, + { id = "trailing-whitespace" }, +] + +[[repos]] +repo = "https://github.com/doublify/pre-commit-rust" +rev = "v1.0" +hooks = [ + { id = "fmt" } +]