From 434e8af5116445e15210e960cdbd16e2b315204b Mon Sep 17 00:00:00 2001 From: Tom - Henry Coursow Date: Thu, 27 Jul 2023 15:29:30 +0200 Subject: [PATCH] Added a new custom gitea composite action which simplifies node module caching --- .gitea/actions/cached-deps-js/action.yml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 .gitea/actions/cached-deps-js/action.yml diff --git a/.gitea/actions/cached-deps-js/action.yml b/.gitea/actions/cached-deps-js/action.yml new file mode 100644 index 0000000..954fa9a --- /dev/null +++ b/.gitea/actions/cached-deps-js/action.yml @@ -0,0 +1,24 @@ +name: 'Get & Cache Dependencies' +description: 'Get the Dependencies from the cache for a (npm) Node JS Project or initialize the cache for it' + +runs: + using: 'composite' # Must be 'composite' for a custom composite action + steps: + - uses: actions/setup-go@v3 + with: + go-version: '1.20' + - uses: actions/go-hashfiles@v0.0.1 + id: get-cache-hash + with: + patterns: |- + **/package-lock.json + - name: Cache dependencies + id: cache + uses: actions/cache@v3 + with: + path: node_modules + key: deps-node-modules-${{ steps.get-cache-hash.outputs.hash }} + - name: Install dependencies + if: steps.cache.outputs.cache-hit != 'true' + run: npm ci + shell: bash # compared to workflow ymls... Action ymls require the 'shell' property when a 'run' property was used! \ No newline at end of file