Skip to content

Commit ca06b8e

Browse files
BUILD-10503 Sanitize workflow name in config-npm
1 parent 829a4d8 commit ca06b8e

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

config-npm/action.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,13 +97,21 @@ runs:
9797
rmdir "${{ steps.setup.outputs.MISE_BACKUP }}"
9898
echo "::endgroup::"
9999
100+
- name: Sanitize workflow name for cache key
101+
id: sanitize_workflow
102+
if: ${{ inputs.cache-npm == 'true' }}
103+
shell: bash
104+
env:
105+
WORKFLOW_NAME: ${{ github.workflow }}
106+
run: echo "workflow_name=${WORKFLOW_NAME// /-}" >> "$GITHUB_OUTPUT"
107+
100108
- name: Cache NPM dependencies
101109
uses: SonarSource/gh-action_cache@v1
102110
if: ${{ inputs.cache-npm == 'true' }}
103111
with:
104112
path: ~/.npm
105-
key: npm-${{ runner.os }}-${{ github.workflow }}-${{ hashFiles('**/package-lock.json') }}
106-
restore-keys: npm-${{ runner.os }}-${{ github.workflow }}-
113+
key: npm-${{ runner.os }}-${{ steps.sanitize_workflow.outputs.workflow_name }}-${{ hashFiles('**/package-lock.json') }}
114+
restore-keys: npm-${{ runner.os }}-${{ steps.sanitize_workflow.outputs.workflow_name }}-
107115

108116
- name: Check for package.json
109117
id: check_package_json

0 commit comments

Comments
 (0)