Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 14 additions & 16 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -98352,6 +98352,18 @@ async function verifyInstallation() {
void run().catch(error => {
main_logger.setFailed(`Action failed: ${error instanceof Error ? error.message : String(error)}`);
});
/**
* Export a single environment variable to the process and GitHub Actions.
*/
function exportEnvVar(key, value) {
const trimmedKey = key.trim();
const trimmedValue = value?.trim() || '';
process.env[trimmedKey] = trimmedValue;
main_logger.exportVariable(trimmedKey, trimmedValue);
if (isVerbose) {
main_logger.debug(`Exported environment variable: ${trimmedKey}=${trimmedValue}`);
}
}
/**
* Process environment variables from input.
* @param inputValue The environment variables input value
Expand All @@ -98368,14 +98380,7 @@ function processEnvVars(inputValue) {
if (typeof envVars === 'object' && envVars !== null) {
for (const [key, value] of Object.entries(envVars)) {
if (key) {
const trimmedKey = key.trim();
const trimmedValue = value?.trim() || '';
process.env[trimmedKey] = trimmedValue;
// Export using GitHub Actions' exportVariable to ensure it's available to subsequent steps.
main_logger.exportVariable(trimmedKey, trimmedValue);
if (isVerbose) {
main_logger.debug(`Exported environment variable: ${trimmedKey}=${trimmedValue}`);
}
exportEnvVar(key, value);
}
else {
main_logger.warning(`Invalid environment variable format: ${key}`);
Expand All @@ -98400,14 +98405,7 @@ function processEnvVars(inputValue) {
if (match) {
const [, key, value] = match;
if (key) {
const trimmedKey = key.trim();
const trimmedValue = value?.trim() || '';
process.env[trimmedKey] = trimmedValue;
// Export using GitHub Actions' exportVariable to ensure it's available to subsequent steps.
main_logger.exportVariable(trimmedKey, trimmedValue);
if (isVerbose) {
main_logger.debug(`Exported variable: ${trimmedKey}=${trimmedValue}`);
}
exportEnvVar(key, value);
}
}
else {
Expand Down
30 changes: 14 additions & 16 deletions dist/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,18 @@ async function verifyInstallation() {
void run().catch(error => {
logger.setFailed(`Action failed: ${error instanceof Error ? error.message : String(error)}`);
});
/**
* Export a single environment variable to the process and GitHub Actions.
*/
function exportEnvVar(key, value) {
const trimmedKey = key.trim();
const trimmedValue = value?.trim() || '';
process.env[trimmedKey] = trimmedValue;
logger.exportVariable(trimmedKey, trimmedValue);
if (isVerbose) {
logger.debug(`Exported environment variable: ${trimmedKey}=${trimmedValue}`);
}
}
/**
* Process environment variables from input.
* @param inputValue The environment variables input value
Expand All @@ -221,14 +233,7 @@ export function processEnvVars(inputValue) {
if (typeof envVars === 'object' && envVars !== null) {
for (const [key, value] of Object.entries(envVars)) {
if (key) {
const trimmedKey = key.trim();
const trimmedValue = value?.trim() || '';
process.env[trimmedKey] = trimmedValue;
// Export using GitHub Actions' exportVariable to ensure it's available to subsequent steps.
logger.exportVariable(trimmedKey, trimmedValue);
if (isVerbose) {
logger.debug(`Exported environment variable: ${trimmedKey}=${trimmedValue}`);
}
exportEnvVar(key, value);
}
else {
logger.warning(`Invalid environment variable format: ${key}`);
Expand All @@ -253,14 +258,7 @@ export function processEnvVars(inputValue) {
if (match) {
const [, key, value] = match;
if (key) {
const trimmedKey = key.trim();
const trimmedValue = value?.trim() || '';
process.env[trimmedKey] = trimmedValue;
// Export using GitHub Actions' exportVariable to ensure it's available to subsequent steps.
logger.exportVariable(trimmedKey, trimmedValue);
if (isVerbose) {
logger.debug(`Exported variable: ${trimmedKey}=${trimmedValue}`);
}
exportEnvVar(key, value);
}
}
else {
Expand Down
31 changes: 15 additions & 16 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,19 @@ void run().catch(error => {
logger.setFailed(`Action failed: ${error instanceof Error ? error.message : String(error)}`);
});

/**
* Export a single environment variable to the process and GitHub Actions.
*/
function exportEnvVar(key: string, value?: string): void {
const trimmedKey = key.trim();
const trimmedValue = value?.trim() || '';
process.env[trimmedKey] = trimmedValue;
logger.exportVariable(trimmedKey, trimmedValue);
if (isVerbose) {
logger.debug(`Exported environment variable: ${trimmedKey}=${trimmedValue}`);
}
}

/**
* Process environment variables from input.
* @param inputValue The environment variables input value
Expand All @@ -259,14 +272,7 @@ export function processEnvVars(inputValue: string): boolean {
if (typeof envVars === 'object' && envVars !== null) {
for (const [key, value] of Object.entries(envVars)) {
if (key) {
const trimmedKey = key.trim();
const trimmedValue = value?.trim() || '';
process.env[trimmedKey] = trimmedValue;
// Export using GitHub Actions' exportVariable to ensure it's available to subsequent steps.
logger.exportVariable(trimmedKey, trimmedValue);
if (isVerbose) {
logger.debug(`Exported environment variable: ${trimmedKey}=${trimmedValue}`);
}
exportEnvVar(key, value);
} else {
logger.warning(`Invalid environment variable format: ${key}`);
}
Expand All @@ -292,14 +298,7 @@ export function processEnvVars(inputValue: string): boolean {
if (match) {
const [, key, value] = match;
if (key) {
const trimmedKey = key.trim();
const trimmedValue = value?.trim() || '';
process.env[trimmedKey] = trimmedValue;
// Export using GitHub Actions' exportVariable to ensure it's available to subsequent steps.
logger.exportVariable(trimmedKey, trimmedValue);
if (isVerbose) {
logger.debug(`Exported variable: ${trimmedKey}=${trimmedValue}`);
}
exportEnvVar(key, value);
}
} else {
logger.warning(`Invalid variable format: ${line}`);
Expand Down