spring-io / asciidoctor-extensions

Asciidoctor extensions (currently Asciidoctor.js only) developed for the Spring docs.
Apache License 2.0
2 stars 5 forks source link

use setup-node action to cache dependencies #1

Closed jongwooo closed 1 year ago

jongwooo commented 1 year ago

Signed-off-by: jongwooo jongwooo.han@gmail.com

Description

Updated workflows to cache dependencies using actions/setup-node. setup-node@v3 or newer has caching built-in.

About caching workflow dependencies

Jobs on GitHub-hosted runners start in a clean virtual environment and must download dependencies each time, causing increased network utilization, longer runtime, and increased cost. To help speed up the time it takes to recreate files like dependencies, GitHub can cache files that frequently use in workflows.

Solutions

Node.js projects can run faster on GitHub Actions by enabling dependency caching on the setup-node action.

AS-IS

- name: Install Node.js 
  uses: actions/setup-node@v3
  with:
    node-version: '16'

TO-BE

- name: Install Node.js 
  uses: actions/setup-node@v3
  with:
    node-version: '16'
    cache: 'npm'

It’s literally a one line change to pass the cache: 'npm' input parameter.

References

rwinch commented 1 year ago

Thanks for the Pull Request! This is now merged into main :smile: