Search code examples
github-actionsgit-lfs

Github Action: How to pull LFS files in submodule


My project contains a submodule that holds LFS files:

mainproject/
   submodule/
     path/to/lfs/file

QUESTION: How do I ensure the LFS files in the submodule are pulled? (Currently they aren't)

In my main.yml file, I do the following:

jobs:
    steps:
...
    - uses: actions/checkout@v2
      with:
        lfs: true
        token: ${{ secrets.ACCESS_TOKEN }}
        submodules: recursive
        fetch-depth: 0

This used to work, but I started getting errors a few weeks ago that I root-caused to the LFS files not being pulled.


Solution

  • This is really weird and appears to be undocumented. I did a little bit of fishing inside my self-hosted runner, and it turns out there's a _work/ inside the github-runner directory where the runner clones repos. This folder gets mapped to /_work/ when running inside a Docker container.

    Somewhere along the way, the repos must have broken and git lfs pull stopped updating the latest files.

    The solution was to log into the runner and wipe out the repos from under _work/.