From 5cf0774335ecd8a3cd5a7403979aeb6a7ac3bd52 Mon Sep 17 00:00:00 2001 From: Ben Sully Date: Thu, 31 Jul 2025 17:18:55 +0100 Subject: [PATCH 1/2] feat: add optional node and npm dependency caching Similar to #181 but for node and npm. This has to be manually enabled because we don't know the user's package manager. --- .github/workflows/cd.yml | 5 +++++ .github/workflows/ci.yml | 8 +++++++- actions/plugins/setup/action.yml | 10 ++++++++++ 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 2d064767..1b984099 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -87,6 +87,10 @@ on: type: boolean required: false default: false + node-cache-dependency-path: + description: Used to specify the path to a dependency file - package-lock.json, yarn.lock, etc. Supports wildcards or a list of file names for caching multiple dependencies (https://github.com/actions/setup-node#caching-global-packages-data) + type: string + required: false # Playwright run-playwright: @@ -334,6 +338,7 @@ jobs: npm-registry-auth: ${{ inputs.npm-registry-auth }} go-version: ${{ inputs.go-version }} go-setup-caching: ${{ inputs.go-setup-caching }} + node-cache-dependency-path: ${{ inputs.node-cache-dependency-path }} node-version: ${{ inputs.node-version }} golangci-lint-version: ${{ inputs.golangci-lint-version }} run-playwright: ${{ inputs.run-playwright }} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0eb6e10d..03e5f5e5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -31,7 +31,7 @@ on: type: string required: false go-setup-caching: - description: Defines if setup-go action should have caching enabled (https://github.com/actions/setup-go#caching-dependency-files-and-build-outputs)olangci-lint version to use + description: Defines if setup-go action should have caching enabled (https://github.com/actions/setup-go#caching-dependency-files-and-build-outputs) type: boolean required: false trufflehog-version: @@ -62,6 +62,10 @@ on: type: boolean required: false default: false + node-cache-dependency-path: + description: Used to specify the path to a dependency file - package-lock.json, yarn.lock, etc. Supports wildcards or a list of file names for caching multiple dependencies (https://github.com/actions/setup-node#caching-global-packages-data) + type: string + required: false # Playwright run-playwright: @@ -279,6 +283,8 @@ jobs: node-version-file: ${{ inputs.plugin-directory }}/.nvmrc golangci-lint-version: ${{ inputs.golangci-lint-version || env.DEFAULT_GOLANGCI_LINT_VERSION }} go-setup-caching: ${{ inputs.go-setup-caching }} + node-cache: ${{ inputs.package-manager }} + node-cache-dependency-path: ${{ inputs.node-cache-dependency-path }} - name: Get secrets from Vault id: get-secrets diff --git a/actions/plugins/setup/action.yml b/actions/plugins/setup/action.yml index 44922611..7aacc49c 100644 --- a/actions/plugins/setup/action.yml +++ b/actions/plugins/setup/action.yml @@ -19,6 +19,14 @@ inputs: description: Node.js version file to use. required: false default: "" + node-cache: + description: Used to specify a package manager for caching in the default directory. Supported values npm, yarn, pnpm (https://github.com/actions/setup-node#caching-global-packages-data) + required: false + default: "" + node-cache-dependency-path: + description: Used to specify the path to a dependency file - package-lock.json, yarn.lock, etc. Supports wildcards or a list of file names for caching multiple dependencies (https://github.com/actions/setup-node#caching-global-packages-data) + required: false + default: "" runs: using: composite @@ -28,6 +36,8 @@ runs: with: node-version: "${{ inputs.node-version }}" node-version-file: "${{ inputs.node-version-file }}" + cache: "${{ inputs.node-cache }}" + cache-dependency-path: "${{ inputs.node-cache-dependency-path }}" - name: Go uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0 From 4a60108c566f4129bfd14ae9317376eaa816b0df Mon Sep 17 00:00:00 2001 From: Ben Sully Date: Tue, 12 Aug 2025 16:19:49 +0100 Subject: [PATCH 2/2] Temp: pin deps to this branch --- .github/workflows/cd.yml | 2 +- .github/workflows/ci.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 1b984099..827246ec 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -328,7 +328,7 @@ jobs: ci: name: CI - uses: grafana/plugin-ci-workflows/.github/workflows/ci.yml@main # zizmor: ignore[unpinned-uses] + uses: grafana/plugin-ci-workflows/.github/workflows/ci.yml@add-optional-node-caching # zizmor: ignore[unpinned-uses] needs: - setup with: diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 03e5f5e5..775bc534 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -276,7 +276,7 @@ jobs: return o - name: Setup - uses: grafana/plugin-ci-workflows/actions/plugins/setup@main # zizmor: ignore[unpinned-uses] + uses: grafana/plugin-ci-workflows/actions/plugins/setup@add-optional-node-caching # zizmor: ignore[unpinned-uses] with: go-version: ${{ inputs.go-version || env.DEFAULT_GO_VERSION }} node-version: ${{ inputs.node-version || env.DEFAULT_NODE_VERSION }}