DEV Community

Discussion on: GitHub Actions Hackathon 2021 Help Thread

Collapse
 
shehab7osny profile image
Shehab Hosny

Hi @blackgirlbytes and @mishmanners

I have a technical question regarding GitHub Actions.

Is it applicable to cache checkout actions?
I mean, if I use multiple workflows that do require to checkout my repository, should I apply the same process each and every time I execute any of these workflows or does the cache action provide any alternative?

I know that caching the checkout isn't the right approach as we do need a new and clean version of the repository after each and every commit, but I also do think that cloning the same repository at each workflow is a little bit time consuming and doesn't make sense. So, what I'm really searching for is a way to only apply checkout once across multiple workflows and load the checkout out directory whenever needed.

I did some research on this topic but I found nothing except this unanswered discussion:
github.com/actions/checkout/discus...

Any help would be appreciated...

Collapse
 
mishmanners profile image
Michelle Mannering

I'm checking in on this and will be back to you soon 😄

Collapse
 
shehab7osny profile image
Shehab Hosny

Thank you a lot Michelle for your efforts! Take your time 😄

Thread Thread
 
mishmanners profile image
Michelle Mannering

See @blackgirlbytes ' amazing response from our team above 😄

Thread Thread
 
shehab7osny profile image
Shehab Hosny

Many thanks for you @mishmanners and @blackgirlbytes ! Much appreciated... I didn't know that actions/checkout@v2 only pulls the latest commit rather than full history. This will definitely help! However, I'm building a C++ project with a varying customizable environment. So, it wouldn't be easy to cache the whole environment, but I will give it a shot anyways. One more time, thank you a lot for the help 😊

Collapse
 
blackgirlbytes profile image
Rizèl Scarlett • Edited

Hey @shehab7osny ! @mishmanners and I did a bit of research, and it looks like for the source code itself we would generally recommend the checkout is most appropriate. By default, it only pulls the latest commit rather than full history so the amount of data being transferred is already reasonably low. You can save significant time by enabling dependency caching when setting up your environment (such as Node or Python). See the relevant setup action (such as github.blog/changelog/2021-07-02-g...) and look for the ‘cache:’ attribute.