| name: Warmup getRemoteJSON's cache | |
| description: Run the script that prepares the disk-cache for getRemoteJSON | |
| inputs: | |
| restore-only: | |
| description: Only attempt to restore, don't warm up | |
| required: false | |
| runs: | |
| using: 'composite' | |
| steps: | |
| # The caching technique here is to unboundedly add and add to the cache. | |
| # You "wrap" the step that appends to disk and it will possibly retrieve | |
| # some from the cache, then save it when it's got more in it. | |
| - name: Cache .remotejson-cache (restore) | |
| uses: actions/cache/restore@v4 | |
| with: | |
| path: .remotejson-cache | |
| key: remotejson-cache- | |
| restore-keys: remotejson-cache- | |
| # When we use this composite action from deployment workflows | |
| # we don't have any Node installed or any of its packages. I.e. we never | |
| # run `npm ci` in those actions. For security sake. | |
| # So we can't do things that require Node code. | |
| # Tests and others will omit the `restore-only` input, but | |
| # prepping for Docker build and push, will set it to a non-empty | |
| # string which basically means "If you can restore it, great. | |
| # If not, that's fine, don't bother". | |
| - name: Run script | |
| if: ${{ inputs.restore-only == '' }} | |
| shell: bash | |
| run: npm run warmup-remotejson | |
| - name: Cache .remotejson-cache (save) | |
| if: ${{ inputs.restore-only == '' }} | |
| uses: actions/cache/save@v4 | |
| with: | |
| path: .remotejson-cache | |
| key: remotejson-cache-${{ github.sha }} | |