From 2e6317af5c813de8c917a2ec724e26e03ff4a4b2 Mon Sep 17 00:00:00 2001
From: Anonymous Maarten <[EMAIL REDACTED]>
Date: Sat, 1 Jul 2023 02:45:22 +0200
Subject: [PATCH] Add github-token input
---
action.yml | 2 ++
packed/index.js | 7 ++++++-
src/main.ts | 6 ++++++
3 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/action.yml b/action.yml
index 4bad6c0..5a5cd2b 100644
--- a/action.yml
+++ b/action.yml
@@ -30,6 +30,8 @@ inputs:
verbose:
description: "Do a verbose build"
default: "false"
+ github-token:
+ description: "A GitHub API token. Not required when version is 2-head, 3-head, or a git hash."
outputs:
prefix:
description: "Actual root of the SDL package"
diff --git a/packed/index.js b/packed/index.js
index c90f10c..3edfd15 100644
--- a/packed/index.js
+++ b/packed/index.js
@@ -348,11 +348,16 @@ function get_cmake_toolchain_path() {
}
function run() {
return __awaiter(this, void 0, void 0, function () {
- var SDL_BUILD_PLATFORM, SETUP_SDL_ROOT, IGNORED_SHELLS, shell_in, SHELL, REQUESTED_VERSION_TYPE, CMAKE_BUILD_TYPE, CMAKE_BUILD_TYPES, git_branch_hash, requested_version, requested_type, github_releases, release_db, sdl_release, GIT_HASH, CMAKE_TOOLCHAIN_FILE, STATE_HASH, PACKAGE_DIR, CACHE_KEY, CACHE_PATHS, sdl_from_cache, BUILD_SDL_TEST, SOURCE_DIR, BUILD_DIR, cmake_configure_args, CMAKE_GENERATOR, SDL_VERSION, pkg_config_path, sdl2_config;
+ var GITHUB_TOKEN, SDL_BUILD_PLATFORM, SETUP_SDL_ROOT, IGNORED_SHELLS, shell_in, SHELL, REQUESTED_VERSION_TYPE, CMAKE_BUILD_TYPE, CMAKE_BUILD_TYPES, git_branch_hash, requested_version, requested_type, github_releases, release_db, sdl_release, GIT_HASH, CMAKE_TOOLCHAIN_FILE, STATE_HASH, PACKAGE_DIR, CACHE_KEY, CACHE_PATHS, sdl_from_cache, BUILD_SDL_TEST, SOURCE_DIR, BUILD_DIR, cmake_configure_args, CMAKE_GENERATOR, SDL_VERSION, pkg_config_path, sdl2_config;
var _this = this;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
+ GITHUB_TOKEN = core.getInput("github-token");
+ if (GITHUB_TOKEN && GITHUB_TOKEN.length > 0) {
+ process.env.GH_TOKEN = GITHUB_TOKEN;
+ process.env.GITHUB_TOKEN = GITHUB_TOKEN;
+ }
SDL_BUILD_PLATFORM = (0, platform_1.get_sdl_build_platform)();
core.info("build platform=".concat(SDL_BUILD_PLATFORM));
SETUP_SDL_ROOT = (0, platform_1.get_platform_root_directory)(SDL_BUILD_PLATFORM);
diff --git a/src/main.ts b/src/main.ts
index f6ee6e6..2c958bc 100644
--- a/src/main.ts
+++ b/src/main.ts
@@ -264,6 +264,12 @@ function get_cmake_toolchain_path(): string | undefined {
}
async function run() {
+ const GITHUB_TOKEN = core.getInput("github-token");
+ if (GITHUB_TOKEN && GITHUB_TOKEN.length > 0) {
+ process.env.GH_TOKEN = GITHUB_TOKEN;
+ process.env.GITHUB_TOKEN = GITHUB_TOKEN;
+ }
+
const SDL_BUILD_PLATFORM = get_sdl_build_platform();
core.info(`build platform=${SDL_BUILD_PLATFORM}`);