Common GitLFS cache configuration

Hey,

Git LFS, powerful, yet not free. CI can generate a lot of bandwidth pulling the same files (e.g. binary frameworks) over and over again.

I am looking for a simple solution, how to:
Clone repository, but retrieve LFS objects from cache if possible. If LFS object(s) is missing or outdated pull it and put it in the cache, to improve next run.

I found similar topics: one, two, but they don’t contain a “copy-n-paste” answer or are still not fully answered. I am trying to understand how exactly cache-pull/push and clone steps are configured.

I think the use-case is so “normal” that it would be awesome if it was a default behaviour (optionally configurable).

Cheers!

I’ve managed to do something like this, but I believe it’s just too much…

  my_workflow:
    description: Whatever
    steps:
    - script@1:
        inputs:
        - content: git lfs uninstall
        title: Uninstall LFS
    - git-clone@6.1: {}
    - cache-pull:
        inputs:
        - is_debug_mode: 'true'
    - script@1:
        inputs:
        - content: |-
            git lfs install
            git lfs pull
        title: Install LFS and Pull
    - cache-push@2:
        inputs:
        - compress_archive: 'true'
        - cache_paths: |-
            .git/lfs