forked from angular/dev-infra
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathaction.yml
More file actions
66 lines (57 loc) · 2.4 KB
/
action.yml
File metadata and controls
66 lines (57 loc) · 2.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
name: 'Checkout and Setup Node'
description: 'Checks out the repository and sets up node environment.'
author: 'Angular'
inputs:
ref:
description: |
The branch, tag or SHA to checkout. Defaults to allowing actions/checkout to determine the ref.
node-version:
description: |
A specific version of node to use for the node environment, exclusive with
node-version-file-path input.
node-version-file-path:
default: '.nvmrc'
description: |
Relative path to the nvm version file to set node version, exclusive with
node-version-file-path input. Defaults to .nvmrc
disable-package-manager-cache:
description: 'When set to true, disables the package manager cache.'
default: false
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.
default: ''
runs:
using: composite
steps:
# Git checkout converts to CRLF by default. This can cause e.g. the Aspect lock
# files to differ. See: https://github.com/actions/checkout/issues/135.
# It's generally a good idea to prevent such automatic transforms.
- run: |
git config --global core.autocrlf false
git config --global core.eol lf
shell: bash
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
with:
filter: blob:none
persist-credentials: false
ref: ${{ inputs.ref }}
- id: packageManager
shell: bash
run: |
PM=$(jq -r '.packageManager | match("^(npm|pnpm|yarn)@").captures[0].string' package.json || echo "")
echo "PACKAGE_MANAGER=$PM" >> "$GITHUB_OUTPUT"
if [ "$PM" == "pnpm" ]; then
echo "CACHE_MANAGER_VALUE=pnpm" >> "$GITHUB_OUTPUT"
fi
- if: steps.packageManager.outputs.PACKAGE_MANAGER == 'pnpm'
uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4.2.0
with:
run_install: false
- uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
with:
node-version-file: ${{ inputs.node-version-file-path }}
node-version: ${{ inputs.node-version }}
cache-dependency-path: ${{ inputs.cache-dependency-path }}
cache: ${{ inputs.disable-package-manager-cache != 'true' && steps.packageManager.outputs.CACHE_MANAGER_VALUE || '' }}