Home
Support Forums

Pulling from LFS in GitHub Action

My site is 199d0847-8b6d-4a96-bf7e-17ba4b119424.netlify.app. I managed to setup visual testing with Percy and Cypress and now I’m trying to put it into a CI pipeline with GitHub Actions. The latest roadblock is pulling from LFS - when I run my Percy startup script locally, everything works, as files are already smudged. But on GitHub, naively toggling with: lfs: true in checkout action didn’t work - I need to configure the Netlify LFS endpoint URL and Auth. How do I do this? Installing Netlify CLI to login and install helper doesn’t feel right.


Aside:
I’ve also seen your blog post about Cypress testing directly in Netlify deploy preview build pipeline, and while I find that ingenious, I probably don’t want to integrate it, especially because I don’t have much visibility into the system - had to deploy 5 times just to get the plugin to do something, and latest error I got was a cryptic ENOENT:

Error log
9:39:58 PM: ────────────────────────────────────────────────────────────────
9:39:58 PM:   4. onSuccess command from /plugins/visual-test                
9:39:58 PM: ────────────────────────────────────────────────────────────────
9:39:58 PM: ​
9:39:58 PM: ​
9:39:58 PM: ────────────────────────────────────────────────────────────────
9:39:58 PM:   Plugin "/plugins/visual-test" internal error                  
9:39:58 PM: ────────────────────────────────────────────────────────────────
9:39:58 PM: ​
9:39:58 PM:   Error message
9:39:58 PM:   Error: spawn env NODE_ENV=development yarn ENOENT
9:39:58 PM: ​
9:39:58 PM:   Plugin details
9:39:58 PM:   Package:        /plugins/visual-test
9:39:58 PM: ​
9:39:58 PM:   Error location
9:39:58 PM:   In "onSuccess" event in "/plugins/visual-test" from netlify.toml
9:39:58 PM:       at Process.ChildProcess._handle.onexit (internal/child_process.js:269:19)
9:39:58 PM:       at onErrorNT (internal/child_process.js:465:16)
9:39:58 PM:       at processTicksAndRejections (internal/process/task_queues.js:80:21)
9:39:58 PM: ​
9:39:58 PM:   Error properties
9:39:58 PM:   {
9:39:58 PM:     errno: -2,
9:39:58 PM:     code: 'ENOENT',
9:39:58 PM:     syscall: 'spawn env NODE_ENV=development yarn',
9:39:58 PM:     path: 'env NODE_ENV=development yarn',
9:39:58 PM:     spawnargs: [],
9:39:58 PM:     originalMessage: 'spawn env NODE_ENV=development yarn ENOENT',
9:39:58 PM:     command: 'env NODE_ENV=development yarn',
9:39:58 PM:     stdout: '',
9:39:58 PM:     stderr: '',
9:39:58 PM:     failed: true,
9:39:58 PM:     timedOut: false,
9:39:58 PM:     isCanceled: false,
9:39:58 PM:     killed: false
9:39:58 PM:   }

So help with this would, of course, be appreciated, but I’d prefer solving it the GitHub Actions way.

Thanks a lot in advance.

Hi, @mvolfik. I see that this site has Large Media enabled. This means that all the Git LFS files are now hosted at Netlify and your Netlify credentials are required to clone those files with Git.

The typical configuration for a site using Large Media is for that site’s builds to be performed at Netlify were the credentials for our Git LFS service (Large Media) are already available to the build system. As these are Netlify specific access keys, GitHub doesn’t have the keys and cannot download the files.

There are two possible solutions:

a) If you are planning to build at GitHub and also continue to use Large Media, then you will need to find some way of providing those credentials to the GitHub action.

or:

b) Stop using Large Media for this site.

If you pick option “b”, uninstalling Large Media will move the Git LFS files back to GitHub and no special credentials will be required to clone the repo. GitHub will host both the default Git files and the Git LFS files so only the GitHub credentials are needed (and GitHub already has it’s own credentials).

If you do choose solution “a”, please read this support guide first:

I want to be clear that you can still use Git LFS when Large Media is disabled. Large Media is a Netlify implementation of a Git LFS service (with some “extras”). However, it is not required to use Large Media if using Git LFS. Git LFS can be used with either the original Git host’s Git LFS implementation or Large Media.

Both will work at Netlify. If they will both work at GitHub remains to be seen.

Now, if you pick option “a”, this requires installing both the Netlify CLI tool and the Git credential helper to the environment which will be cloning the repo at GitHub. I do not personally know if this is possible or not. However, if you do want to attempt option “a”, I’d be happy to take a look at the GitHub Actions documentation to see if I can see a way forward.

​Please let us know if which solution you prefer and we will proceed from there.