Skip to content
download

GitHub Action

Cached LFS checkout

v1.2.3 Latest version

Cached LFS checkout

download

Cached LFS checkout

Git checkout with LFS files from cache

Installation

Copy and paste the following snippet into your .yml file.

              


- name: Cached LFS checkout

uses: nschloe/[email protected]

Learn more about this action in nschloe/action-cached-lfs-checkout

Choose a version

GitHub action: Cached LFS checkout

Storing (large) binary files in Git trees is not recommended because any change to the file will result in a re-upload of the entire file when pushing, increasing the size of the Git repository. When updating a 100 MB file 100 times, your repository will be 10 GB in size!

As a remedy, there is Git LFS which stores certain files only as pointers in the Git tree, downloading the actual data from somewhere else when pulling. The repository size remains small.

GitHub applies some fees when the total amount of LFS downloads surpasses 1GB. Unfortunately, even gh-actions runs, when used with

- name: Checkout code
  uses: actions/checkout@v4
  with:
    lfs: true

count towards that limit. To cache the LFS downloads, you can instead use this action. Simply replace the above by

- name: Checkout code
  uses: nschloe/action-cached-lfs-checkout@v1
  # Use these to explicitly include/exclude files:
  # with:
  #   include: "*"
  #   exclude: ""

Check it out on the GitHub Marketplace!

Further reading

License

The scripts and documentation in this project are released under the MIT License.