diff --git a/tools/ci_build/github/azure-pipelines/templates/mac-cpu-packing-jobs.yml b/tools/ci_build/github/azure-pipelines/templates/mac-cpu-packing-jobs.yml index d646287ad2..411c2277e7 100644 --- a/tools/ci_build/github/azure-pipelines/templates/mac-cpu-packing-jobs.yml +++ b/tools/ci_build/github/azure-pipelines/templates/mac-cpu-packing-jobs.yml @@ -92,9 +92,13 @@ jobs: parameters: CacheDir: $(PROTO_CACHE_DIR) + # If it's a merge build, the run will read the cache generated by main build. - task: Cache@2 inputs: - key: ' "$(TODAY)" | ccache | onnxruntime | "$(Build.SourceVersion)" ' + ${{if eq(variables['Build.SourceBranchName'], 'merge')}}: + key: ' "$(TODAY)" | ccache | merge ' + ${{else}}: + key: ' "$(TODAY)" | ccache | onnxruntime | $(Build.SourceVersion) ' path: $(ORT_CACHE_DIR) restoreKeys: | "$(TODAY)" | ccache | onnxruntime