Skip to content
  • Blake Friedman's avatar
    Only cache node_modules on main (#45544) · 4410899e
    Blake Friedman authored
    Summary:
    Pull Request resolved: https://github.com/facebook/react-native/pull/45544
    
    ## This diff now does 5 things:
    1. removes the old way we used `actions/setup-node` to manage the cache itself.
    2. it creates a new `update-node-modules-cache` workflow, which is the only job that will update the node modules cache
    3. it create a `yarn-install-with-cache` action that should be used install of directly calling `yarn install --non-interactive`.  This will load a cache against a hash of `package.json`.
    4. updated the cache reaper to aggressively remove everything but the latest `npm-{{ hash('package.json') }}`.
    5. removed a `cache-setup`, which couldn't be used (we're using artefacts now).
    
    ## Why are we doing this:
    The various `node-cache-` keys for platforms and on various branches accounts for a very large proportion of the cache (10-20%).
    
    We don't frequently change these dependencies, and even when we do running `yarn install` after loading the cache will resolve any issues.
    
    Limiting the cache to `main` and aggressively pruning older cache entries will clean up a lot of "small win" caching.
    
    Changelog: [Internal]
    
    Reviewed By: cortinico
    
    Differential Revision: D59917944
    
    fbshipit-source-id: 4be6f1959e8fde642a4f208f7d19aceba2c3262f
    4410899e