From 44900553c0f595f321994102d1718f59b4c1fbee Mon Sep 17 00:00:00 2001 From: Snowball_233 Date: Fri, 23 Jan 2026 00:56:04 +0800 Subject: [PATCH] Improve cargo cache with static key and skip reinstall if exists --- .github/workflows/epub.yml | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/workflows/epub.yml b/.github/workflows/epub.yml index 6896cc21..dddcf828 100644 --- a/.github/workflows/epub.yml +++ b/.github/workflows/epub.yml @@ -16,7 +16,7 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Cache cargo registry + - name: Cache cargo uses: actions/cache@v4 with: path: | @@ -24,9 +24,9 @@ jobs: ~/.cargo/registry/index/ ~/.cargo/registry/cache/ ~/.cargo/git/db/ - key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + key: ${{ runner.os }}-cargo-mdbook-pandoc-v1 restore-keys: | - ${{ runner.os }}-cargo- + ${{ runner.os }}-cargo-mdbook-pandoc- - name: Install mdbook uses: peaceiris/actions-mdbook@v2 @@ -49,7 +49,11 @@ jobs: - name: Install mdbook-pandoc run: | - cargo install mdbook-pandoc + if ! command -v mdbook-pandoc &> /dev/null; then + cargo install mdbook-pandoc + else + echo "mdbook-pandoc already installed" + fi - name: Build Book run: mdbook build