Skip to content

Commit 37ee7d1

Browse files
committed
feat(dependencies-cache): add support for Astro and Docusaurus
Signed-off-by: Emilien Escalle <[email protected]>
1 parent d79105e commit 37ee7d1

File tree

3 files changed

+46
-3
lines changed

3 files changed

+46
-3
lines changed

actions/dependencies-cache/README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,16 @@
2626

2727
Action to setup dependencies cache managment.
2828

29+
### Supported caches
30+
31+
- NX (`node_modules/.cache/nx`)
32+
- Prettier (`node_modules/.cache/prettier`)
33+
- Docusaurus (`.docusaurus`, `node_modules/.cache/webpack`)
34+
- Astro (`node_modules/.astro`)
35+
- Gatsby (`.cache`, `public`)
36+
- Storybook (`node_modules/.cache/storybook`)
37+
- Jest (auto-detected `cacheDirectory`)
38+
2939
<!-- overview:end -->
3040

3141
<!-- usage:start -->

actions/dependencies-cache/action.yml

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
name: "Dependencies cache"
2-
description: "Action to setup dependencies cache managment."
2+
description: |
3+
Action to setup dependencies cache managment.
4+
5+
### Supported caches
6+
7+
- NX (`node_modules/.cache/nx`)
8+
- Prettier (`node_modules/.cache/prettier`)
9+
- Docusaurus (`.docusaurus`, `node_modules/.cache/webpack`)
10+
- Astro (`node_modules/.astro`)
11+
- Gatsby (`.cache`, `public`)
12+
- Storybook (`node_modules/.cache/storybook`)
13+
- Jest (auto-detected `cacheDirectory`)
14+
315
author: hoverkraft
416
branding:
517
icon: archive
@@ -54,6 +66,26 @@ runs:
5466
restore-keys: |
5567
${{ runner.os }}-cache-prettier-
5668
69+
- name: ♻️ Docusaurus cache
70+
if: fromJson(steps.has-installed-dependencies.outputs.installed-dependencies).docusaurus == true
71+
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
72+
with:
73+
path: |
74+
${{ inputs.working-directory }}/.docusaurus
75+
${{ inputs.working-directory }}/node_modules/.cache/webpack
76+
key: ${{ runner.os }}-cache-docusaurus-${{ github.sha }}
77+
restore-keys: |
78+
${{ runner.os }}-cache-docusaurus-
79+
80+
- name: ♻️ Astro cache
81+
if: fromJson(steps.has-installed-dependencies.outputs.installed-dependencies).astro == true
82+
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
83+
with:
84+
path: ${{ inputs.working-directory }}/node_modules/.astro
85+
key: ${{ runner.os }}-cache-astro-${{ github.sha }}
86+
restore-keys: |
87+
${{ runner.os }}-cache-astro-
88+
5789
- name: ♻️ Gatsby cache
5890
if: fromJson(steps.has-installed-dependencies.outputs.installed-dependencies).gatsby == true
5991
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0

actions/has-installed-dependencies/action.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,9 @@ runs:
6464
process.chdir(workingDirectory);
6565
6666
const dependenciesPatterns = {
67-
storybook: /@storybook\/[-a-z]+/,
68-
nx: /@nx\/[-a-z]+/,
67+
storybook: /@storybook\/[a-z0-9\-]+/,
68+
nx: /@nx\/[a-z0-9\-]+/,
69+
docusaurus: /@docusaurus\/[a-z0-9\-]+/,
6970
};
7071
7172
const dependencies = `${{ inputs.dependencies }}`.split('\n').map(x => x.trim()).filter(x => x !== '');

0 commit comments

Comments
 (0)