Visitar URL original
[actions] retry `npm install` on Windows to survive npm 2/3 staging-r… · ljharb/shell-quote@abe0163 · GitHub
Skip to content

Commit abe0163

Browse files
committed
[actions] retry npm install on Windows to survive npm 2/3 staging-rename flake
1 parent 7a76c1a commit abe0163

1 file changed

Lines changed: 23 additions & 3 deletions

File tree

‎.github/workflows/nodejs.yml‎

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,24 @@ jobs:
5757
if: matrix.os == 'windows-latest'
5858

5959
- name: upgrade npm
60-
run: npm install -g npm@6
60+
run: |
61+
for i in 1 2 3; do npm install -g npm@6 && exit 0 || sleep 5; done
62+
shell: bash
6163
env:
6264
NPM_CONFIG_STRICT_SSL: false
6365
if: matrix.os == 'windows-latest' && matrix.node-version >= 6 && matrix.node-version <= 9
6466
continue-on-error: true
6567

66-
- run: npm install
68+
- name: npm install (retry; npm 2/3 staging-rename flake on Windows)
69+
run: |
70+
for i in 1 2 3; do
71+
npm install && exit 0
72+
echo "::warning::npm install attempt $i failed; cleaning node_modules and retrying"
73+
rm -rf node_modules
74+
sleep 10
75+
done
76+
exit 1
77+
shell: bash
6778
env:
6879
NPM_CONFIG_STRICT_SSL: false
6980
if: matrix.os == 'windows-latest'
@@ -103,7 +114,16 @@ jobs:
103114
node-version: ${{ matrix.node-version }}
104115
if: matrix.os == 'windows-latest'
105116

106-
- run: npm install
117+
- name: npm install (retry; npm 2/3 staging-rename flake on Windows)
118+
run: |
119+
for i in 1 2 3; do
120+
npm install && exit 0
121+
echo "::warning::npm install attempt $i failed; cleaning node_modules and retrying"
122+
rm -rf node_modules
123+
sleep 10
124+
done
125+
exit 1
126+
shell: bash
107127
env:
108128
NPM_CONFIG_STRICT_SSL: false
109129
if: matrix.os == 'windows-latest'

0 commit comments

Comments
 (0)