From 61d32b67df62c9ceadb079e10301bde89cfb1949 Mon Sep 17 00:00:00 2001 From: realfresh <7835503+realfresh@users.noreply.github.com> Date: Sat, 29 Aug 2026 11:30:13 +0800 Subject: [PATCH] ci: validate pull requests before merge Run the test workflow for pull requests while guarding every release job with an explicit version-tag check. Resolve the current stable Clippy lint so validation starts green. --- .github/workflows/release.yml | 14 ++++++------ src/commands/search/handlers.rs | 38 ++++++++++++++++----------------- 2 files changed, 27 insertions(+), 25 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b741b95..baa2efb 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -2,9 +2,11 @@ # https://github.com/open-contracting/cardinal-rs/blob/main/.github/workflows/release.yml name: Test & Release -# The name is either "Release vX.X.X" on tag push or the commit message -run-name: ${{ github.ref_name != 'main' && format('Release - {0}', github.ref_name) || github.event.head_commit.message }} +# The name is the PR title, "Release vX.X.X" on tag push, or the commit message +run-name: ${{ github.event_name == 'pull_request' && format('PR {0} - {1}', github.event.pull_request.number, github.event.pull_request.title) || github.ref_type == 'tag' && format('Release - {0}', github.ref_name) || github.event.head_commit.message }} on: + pull_request: + branches: [ "main" ] push: branches: [ "main" ] tags: [ "v[0-9]+.[0-9]+.[0-9]+" ] @@ -25,7 +27,7 @@ jobs: - name: Setup Cache uses: Swatinem/rust-cache@v2 - if: github.ref_name == 'main' # Caching doesn't work on tags, so skip it + if: github.ref_type != 'tag' # Caching doesn't work on tags, so skip it with: cache-targets: "true" cache-on-failure: "true" @@ -41,7 +43,7 @@ jobs: name: Setup needs: test runs-on: ubuntu-latest - if: github.ref_name != 'main' # Only run on tag push + if: startsWith(github.ref, 'refs/tags/v') # Only run on tag push steps: - name: Checkout uses: actions/checkout@v3 @@ -54,7 +56,7 @@ jobs: name: Build needs: setup runs-on: ${{ matrix.runner }} - if: github.ref_name != 'main' # Only run on tag push + if: startsWith(github.ref, 'refs/tags/v') # Only run on tag push strategy: matrix: include: @@ -110,7 +112,7 @@ jobs: name: Release needs: build runs-on: ubuntu-latest - if: github.ref_name != 'main' # Only run on tag push + if: startsWith(github.ref, 'refs/tags/v') # Only run on tag push steps: - name: Checkout uses: actions/checkout@v3 diff --git a/src/commands/search/handlers.rs b/src/commands/search/handlers.rs index f8e27c9..51113fa 100644 --- a/src/commands/search/handlers.rs +++ b/src/commands/search/handlers.rs @@ -195,27 +195,27 @@ pub fn handle_mouse_events(event: MouseEvent, app: &mut UIState) -> Result<()> { // Select a template with left-click MouseEventKind::Down(MouseButton::Left) => app.list_select(), // Scrolling on the collection templates list - MouseEventKind::ScrollUp => { - if now.duration_since(app.last_scroll_time) > Duration::from_millis(15) { - app.list_previous(if is_shift || is_alt { - Some(10) - } else { - Some(1) - }); - app.last_scroll_time = now; - } + MouseEventKind::ScrollUp + if now.duration_since(app.last_scroll_time) > Duration::from_millis(15) => + { + app.list_previous(if is_shift || is_alt { + Some(10) + } else { + Some(1) + }); + app.last_scroll_time = now; } // Scrolling on the collection templates list - MouseEventKind::ScrollDown => { - if now.duration_since(app.last_scroll_time) > Duration::from_millis(15) { - app.list_next(if is_shift || is_alt { - println!("Scrolling {is_shift} {is_alt}"); - Some(10) - } else { - Some(1) - }); - app.last_scroll_time = now; - } + MouseEventKind::ScrollDown + if now.duration_since(app.last_scroll_time) > Duration::from_millis(15) => + { + app.list_next(if is_shift || is_alt { + println!("Scrolling {is_shift} {is_alt}"); + Some(10) + } else { + Some(1) + }); + app.last_scroll_time = now; } _ => {} }