From 0fad19e82b82a3883b6a733b0e2c04acf41c853b Mon Sep 17 00:00:00 2001
From: Anonymous Maarten <[EMAIL REDACTED]>
Date: Sat, 17 Jun 2023 05:19:03 +0200
Subject: [PATCH] make version input case insensitive + allow sdl prefix +
group git fetch SDL commands in one group
---
action.yml | 2 +-
packed/index.js | 9 ++++++---
src/main.ts | 5 ++---
src/version.ts | 4 ++++
4 files changed, 13 insertions(+), 7 deletions(-)
diff --git a/action.yml b/action.yml
index 8d36234c2f88..2f53fd2ce3dd 100644
--- a/action.yml
+++ b/action.yml
@@ -3,7 +3,7 @@ description: "Set up SDL and add the path of SDL2.dll to the PATH."
inputs:
version:
description: "Minimum required version of SDL (2.x.y, 2-any, 2-latest, 2-head, 3-head), or git hash"
- default: "2-HEAD"
+ default: "2-any"
required: true
pre-release:
description: "Allow pre-releases"
diff --git a/packed/index.js b/packed/index.js
index d5062eb31a5c..d3dce6853fba 100644
--- a/packed/index.js
+++ b/packed/index.js
@@ -101,9 +101,8 @@ async function convert_git_branch_tag_to_hash(branch_tag) {
return git_hash;
}
async function echo_command_and_execute(command, directory) {
- await core.group(`Executing "${command}`, async () => {
- child_process.execSync(command, { stdio: "inherit", cwd: directory });
- });
+ core.info(`Executing "${command}`);
+ child_process.execSync(command, { stdio: "inherit", cwd: directory });
}
async function checkout_sdl_git_hash(branch_tag_hash, directory) {
fs.mkdirSync(directory, { recursive: true });
@@ -393,6 +392,10 @@ function parse_requested_sdl_version(version_request) {
const LATEST_SUFFIX = "-latest";
let version;
let version_type;
+ version_request = version_request.toLowerCase();
+ if (version_request.startsWith("sdl")) {
+ version_request = version_request.substring(3);
+ }
try {
if (version_request.endsWith(HEAD_SUFFIX)) {
version_type = SdlReleaseType.Head;
diff --git a/src/main.ts b/src/main.ts
index 506625b2a58a..ef18aac82266 100644
--- a/src/main.ts
+++ b/src/main.ts
@@ -69,9 +69,8 @@ async function convert_git_branch_tag_to_hash(
}
async function echo_command_and_execute(command: string, directory: string) {
- await core.group(`Executing "${command}`, async () => {
- child_process.execSync(command, { stdio: "inherit", cwd: directory });
- });
+ core.info(`Executing "${command}`);
+ child_process.execSync(command, { stdio: "inherit", cwd: directory });
}
async function checkout_sdl_git_hash(
diff --git a/src/version.ts b/src/version.ts
index 3d1c0fe43b58..8b0a6a622e4a 100644
--- a/src/version.ts
+++ b/src/version.ts
@@ -172,6 +172,10 @@ export function parse_requested_sdl_version(
const LATEST_SUFFIX = "-latest";
let version: SdlVersion;
let version_type: SdlReleaseType;
+ version_request = version_request.toLowerCase();
+ if (version_request.startsWith("sdl")) {
+ version_request = version_request.substring(3);
+ }
try {
if (version_request.endsWith(HEAD_SUFFIX)) {
version_type = SdlReleaseType.Head;