From d6c8f598a6ed47bfb417b3ef3a3e1b651e1ef3c3 Mon Sep 17 00:00:00 2001
From: Paul Yushkevich <pyushkevich@gmail.com>
Date: Fri, 4 Oct 2024 11:35:08 -0400
Subject: [PATCH] Update build.yml

---
 .github/workflows/build.yml | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index f149718e..fc1ce852 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -191,6 +191,7 @@ jobs:
 
       # Checkout ITK-SNAP code
       - name: Checkout code
+        if: ${{ github.event_name == 'workflow_dispatch' && inputs.use_cached_itksnap_build }}
         uses: actions/checkout@v4
         with:
             submodules: true
@@ -199,6 +200,7 @@ jobs:
 
       # Configure ITK-SNAP
       - name: Configure ITK-SNAP
+        if: ${{ github.event_name == 'workflow_dispatch' && inputs.use_cached_itksnap_build }}
         uses: threeal/cmake-action@v2.0.0
         continue-on-error: true
         with:
@@ -218,6 +220,7 @@ jobs:
 
       # Build ITK-SNAP using CDash
       - name: Build and Test ITK-SNAP
+        if: ${{ github.event_name == 'workflow_dispatch' && inputs.use_cached_itksnap_build }}
         working-directory: ${{github.workspace}}/itksnap/build
         run: |
           ${{ matrix.test_pref }} ctest -D ExperimentalStart
@@ -228,6 +231,7 @@ jobs:
 
       # Cache the ITK-SNAP build
       - name: Cache ITK-SNAP build directory
+        if: ${{ github.event_name == 'workflow_dispatch' && inputs.use_cached_itksnap_build }}
         uses: actions/cache/save@v4
         with:
           path: ${{github.workspace}}/itksnap
@@ -237,7 +241,7 @@ jobs:
       - name: Package ITK-SNAP
         working-directory: ${{github.workspace}}/itksnap/build
         run: |
-          cmake --build -t package
+          cmake --build -- -t package
       
       - name: Setup tmate session
         uses: mxschmitt/action-tmate@v3