From f17f538c3440732d00ee7a273e99b8e2879e3f99 Mon Sep 17 00:00:00 2001 From: benbenbang Date: Sun, 28 Jun 2026 21:57:02 +0800 Subject: [PATCH] ci(.github): add pre-commit checks and refine PR workflow This pull request restructures the pull request workflow to add a reusable pre-commit checks job and refines the PR labeler configuration while removing the inline Rust build and test job. **Workflow trigger updates:** * Added explicit `types` filter to the `pull_request` trigger, restricting runs to `opened`, `synchronize`, `edited`, and `reopened` events. **Pre-commit integration:** * Added a new `pre-commit` job that uses the reusable `benbenbang/reusable-workflows/.github/workflows/prek.yml@1.0.1` workflow with read permissions and inherited secrets. **PR labeler refinements:** * Added a name and a fork guard (`github.event.pull_request.head.repo.fork == false`) to the `pr-labeler` job, granted `issues: write` permission, and upgraded checkout to `actions/checkout@v5`. **Job cleanup:** * Removed the inline `rust-build-and-tests` job, which built the binary and ran tests, in favor of the reusable pre-commit workflow. --- .github/workflows/pull-request.yml | 35 +++++++++++++++--------------- 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index aaa39ac..d0e20bd 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -4,40 +4,39 @@ on: pull_request: branches: - main + types: + - opened + - synchronize + - edited + - reopened concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: + pre-commit: + name: pre-commit checks + uses: benbenbang/reusable-workflows/.github/workflows/prek.yml@1.0.1 + permissions: + contents: read + packages: read + secrets: inherit + pr-labeler: + name: pr labeler runs-on: ubuntu-latest + if: ${{ github.event.pull_request.head.repo.fork == false }} permissions: contents: read pull-requests: write + issues: write steps: - name: checkout repository - uses: actions/checkout@v4 + uses: actions/checkout@v5 - name: pr labeler uses: actions/labeler@v5 with: repo-token: ${{ secrets.GITHUB_TOKEN }} configuration-path: .github/labeler.yml - - rust-build-and-tests: - runs-on: ubuntu-latest - container: ghcr.io/benbenbang/uv-shell/prek - permissions: - contents: read - pull-requests: write - packages: read - steps: - - name: checkout repository - uses: actions/checkout@v5 - - name: build binary - run: cargo build --verbose - - name: run test - run: cargo test --verbose - env: - CARGO_TERM_COLOR: always