Skip to content

Commit c3b1019

Browse files
author
Robert Jackson
committed
Release 4.0.0-beta.3
1 parent ed142f2 commit c3b1019

File tree

4 files changed

+50
-12
lines changed

4 files changed

+50
-12
lines changed

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,18 @@
55

66

77

8+
9+
## v4.0.0-beta.3 (2022-10-03)
10+
11+
#### :bug: Bug Fix
12+
* [#110](https://github.com/volta-cli/action/pull/110) Fix for self-hoster runners (instead of relying on `RUNNER_TEMP`) ([@jeevcat](https://github.com/jeevcat))
13+
* [#111](https://github.com/volta-cli/action/pull/111) Fall back to downloading latest version from volta.sh on rate-limit ([@ZauberNerd](https://github.com/ZauberNerd))
14+
15+
#### Committers: 2
16+
- Björn Brauer ([@ZauberNerd](https://github.com/ZauberNerd))
17+
- Sam Jeeves ([@jeevcat](https://github.com/jeevcat))
18+
19+
820
## v4.0.0-beta.2 (2022-09-09)
921

1022
#### :rocket: Enhancement

dist/index.js

Lines changed: 35 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22839,14 +22839,14 @@ var core = __nccwpck_require__(2186);
2283922839
var external_fs_ = __nccwpck_require__(7147);
2284022840
// EXTERNAL MODULE: external "path"
2284122841
var external_path_ = __nccwpck_require__(1017);
22842+
// EXTERNAL MODULE: ./node_modules/@actions/exec/lib/exec.js
22843+
var exec = __nccwpck_require__(1514);
2284222844
// EXTERNAL MODULE: ./node_modules/@actions/http-client/lib/index.js
2284322845
var lib = __nccwpck_require__(6255);
22844-
// EXTERNAL MODULE: ./node_modules/@actions/tool-cache/lib/tool-cache.js
22845-
var tool_cache = __nccwpck_require__(7784);
2284622846
// EXTERNAL MODULE: ./node_modules/@actions/io/lib/io.js
2284722847
var io = __nccwpck_require__(7436);
22848-
// EXTERNAL MODULE: ./node_modules/@actions/exec/lib/exec.js
22849-
var exec = __nccwpck_require__(1514);
22848+
// EXTERNAL MODULE: ./node_modules/@actions/tool-cache/lib/tool-cache.js
22849+
var tool_cache = __nccwpck_require__(7784);
2285022850
// EXTERNAL MODULE: external "os"
2285122851
var external_os_ = __nccwpck_require__(2037);
2285222852
// EXTERNAL MODULE: ./node_modules/semver/index.js
@@ -22888,11 +22888,36 @@ async function getLatestVolta(authToken) {
2288822888
authorization: authToken,
2288922889
};
2289022890
}
22891-
const response = await http.getJson(url, headers);
22892-
if (!response.result) {
22891+
try {
22892+
const response = await http.getJson(url, headers);
22893+
if (!response.result) {
22894+
throw new Error(`volta-cli/action: Could not download latest release from ${url}`);
22895+
}
22896+
return semver.clean(response.result.name);
22897+
}
22898+
catch (error) {
22899+
if (error instanceof lib.HttpClientError &&
22900+
(error.statusCode === 403 || error.statusCode === 429)) {
22901+
core.info(`Received HTTP status code ${error.statusCode}. This usually indicates the rate limit has been exceeded`);
22902+
return await getLatestVoltaFromVoltaSH();
22903+
}
22904+
else {
22905+
throw error;
22906+
}
22907+
}
22908+
}
22909+
async function getLatestVoltaFromVoltaSH() {
22910+
const url = 'https://volta.sh/latest-version';
22911+
core.info(`Falling back to download from ${url}`);
22912+
const http = new lib.HttpClient('volta-cli/action', [], {
22913+
allowRetries: true,
22914+
maxRetries: 3,
22915+
});
22916+
const response = await http.get(url);
22917+
if (response.message.statusCode !== 200) {
2289322918
throw new Error(`volta-cli/action: Could not download latest release from ${url}`);
2289422919
}
22895-
return semver.clean(response.result.name);
22920+
return semver.clean(await response.readBody());
2289622921
}
2289722922
function voltaVersionHasSetup(version) {
2289822923
return semver.gte(version, '0.7.0');
@@ -23025,7 +23050,8 @@ async function acquireVolta(version, options) {
2302523050
}
2302623051
async function setupVolta(version, voltaHome) {
2302723052
if (voltaVersionHasSetup(version)) {
23028-
await (0,exec.exec)(external_path_.join(voltaHome, 'bin', 'volta'), ['setup'], {
23053+
const executable = external_path_.join(voltaHome, 'bin', 'volta');
23054+
await (0,exec.exec)(executable, ['setup'], {
2302923055
env: {
2303023056
// VOLTA_HOME needs to be set before calling volta setup
2303123057
VOLTA_HOME: voltaHome,
@@ -23095,10 +23121,10 @@ async function getVolta(options) {
2309523121
if (voltaHome === '') {
2309623122
// download, extract, cache
2309723123
const toolRoot = await acquireVolta(version, options);
23098-
await setupVolta(version, toolRoot);
2309923124
// Install into the local tool cache - node extracts with a root folder
2310023125
// that matches the fileName downloaded
2310123126
voltaHome = await tool_cache.cacheDir(toolRoot, 'volta', version);
23127+
await setupVolta(version, voltaHome);
2310223128
core.info(`caching volta@${version} into ${voltaHome}`);
2310323129
}
2310423130
else {

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@volta-cli/action",
3-
"version": "4.0.0-beta.2",
3+
"version": "4.0.0-beta.3",
44
"private": true,
55
"description": "Setup volta for usage in your CI runs",
66
"keywords": [

0 commit comments

Comments
 (0)