oxsecurity / megalinter

🦙 MegaLinter analyzes 50 languages, 22 formats, 21 tooling formats, excessive copy-pastes, spelling mistakes and security issues in your repository sources with a GitHub Action, other CI tools or locally.
https://megalinter.io
GNU Affero General Public License v3.0
1.81k stars 215 forks source link

How to cache Megalinter in github actions? #3738

Open vonbraunbates opened 3 days ago

vonbraunbates commented 3 days ago

Most of my actions mintues on a linter run are spent downloading the ~4GB Docker image. There's no flavour I can use to reduce this. Github Actions support suggests that I can cache the image, but how do I actually go about doing this? Has anyone tried it before with a successful result? Are there any arguments against doing this?

echoix commented 3 days ago

Last time I tried, I wasn't able to do anything for that. GitHub actions, when the action type is docker like ours, have the image pulled before starting, before running any step. Thus it can't work. But, if you drop the action and use the mega-linter-runner, like locally, you would be able to do something. If you think the actions cache server is faster than the docker server, you can try pulling from the ghcr registry where we upload it too. I expect it to be at the same level as the actions cache servers.

I'm sceptical that actions cache will really be faster, since it can only unpack once downloaded, and you still have to load the image to docker afterwards