Skip to content

Commit 5c354be

Browse files
committed
Allow rX.Y.Z in version name
1 parent ffa8721 commit 5c354be

File tree

9 files changed

+4879
-1248
lines changed

9 files changed

+4879
-1248
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
fail-fast: false
3030
matrix:
3131
os: [ ubuntu-22.04, ubuntu-24.04, ubuntu-latest, windows-latest ]
32-
version: [ latest, 1.12.0 ]
32+
version: [ latest, 1.12.0, r1.16.2 ]
3333
exclude:
3434
- os: ubuntu-latest
3535
version: 1.12.0

dist/index.js

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28718,6 +28718,7 @@ const rest_1 = __nccwpck_require__(1273);
2871828718
const exec_1 = __nccwpck_require__(1514);
2871928719
const tool_cache_1 = __nccwpck_require__(7784);
2872028720
const promises_1 = __importDefault(__nccwpck_require__(3977));
28721+
const util_1 = __nccwpck_require__(2629);
2872128722
const octokit = new rest_1.Octokit({
2872228723
auth: process.env.GITHUB_TOKEN
2872328724
});
@@ -28831,19 +28832,42 @@ function run() {
2883128832
core.info(`Rate limit status: ${JSON.stringify(data.resources.core)}`);
2883228833
const version = core.getInput("version") || "latest";
2883328834
core.info(`Requested version is ${version}`);
28834-
if (version === "latest") {
28835+
const validVersion = (0, util_1.validateVersion)(version);
28836+
if (validVersion === null) {
28837+
throw new Error(`Invalid version ${version}: use "latest", "X.Y.Z", or "rX.Y.Z"`);
28838+
}
28839+
if (validVersion === "latest") {
2883528840
const rel = yield getLatestRelease();
2883628841
installRelease(rel);
2883728842
}
2883828843
else {
28839-
const rel = yield getNamedRelease(version);
28844+
const rel = yield getNamedRelease(validVersion);
2884028845
installRelease(rel);
2884128846
}
2884228847
});
2884328848
}
2884428849
run();
2884528850

2884628851

28852+
/***/ }),
28853+
28854+
/***/ 2629:
28855+
/***/ ((__unused_webpack_module, exports) => {
28856+
28857+
28858+
Object.defineProperty(exports, "__esModule", ({ value: true }));
28859+
exports.validateVersion = void 0;
28860+
const versionRegex = /^r?(\d+\.\d+\.\d+)$/;
28861+
function validateVersion(input) {
28862+
if (input == "latest") {
28863+
return input;
28864+
}
28865+
const match = versionRegex.exec(input);
28866+
return match ? match[1] : null;
28867+
}
28868+
exports.validateVersion = validateVersion;
28869+
28870+
2884728871
/***/ }),
2884828872

2884928873
/***/ 9491:

jest.config.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
export default {
2+
preset: "ts-jest/presets/default-esm",
3+
testEnvironment: "node",
4+
extensionsToTreatAsEsm: [".ts"],
5+
transform: {
6+
"^.+\\.ts$": ["ts-jest", {
7+
useESM: true,
8+
tsconfig: "tsconfig.json",
9+
}],
10+
},
11+
testMatch: ["**/__tests__/**/*.ts", "**/?(*.)+(spec|test).ts"],
12+
};

0 commit comments

Comments
 (0)