update ts docs

This commit is contained in:
Salman Chishti committed 2025-03-13 04:47:49 -07:00
1 parent 9e3b2c234f
commit b685da493c
2 files changed
+53 -5

No files matched your search

+27 -4
View File
@@ -11,14 +11,37 @@ export interface CommandProperties {
} }
/** /**
* Commands * Issues a command to the GitHub Actions runner
*
* @param command - The command name to issue
* @param properties - Additional properties for the command (key-value pairs)
* @param message - The message to include with the command
* @remarks
* This function outputs a specially formatted string to stdout that the Actions
* runner interprets as a command. These commands can control workflow behavior,
* set outputs, create annotations, mask values, and more.
* *
* Command Format: * Command Format:
* ::name key=value,key=value::message * ::name key=value,key=value::message
* *
* Examples: * @example
* ::warning::This is the message * ```typescript
* ::set-env name=MY_VAR::some value * // Issue a warning annotation
* issueCommand('warning', {}, 'This is a warning message');
* // Output: ::warning::This is a warning message
*
* // Set an environment variable
* issueCommand('set-env', { name: 'MY_VAR' }, 'some value');
* // Output: ::set-env name=MY_VAR::some value
*
* // Add a secret mask
* issueCommand('add-mask', {}, 'secretValue123');
* // Output: ::add-mask::secretValue123
* ```
*
* @internal
* This is an internal utility function that powers the public API functions
* such as setSecret, warning, error, and exportVariable.
*/ */
export function issueCommand( export function issueCommand(
command: string, command: string,
+26 -1
View File
@@ -94,7 +94,32 @@ export function exportVariable(name: string, val: any): void {
/** /**
* Registers a secret which will get masked from logs * Registers a secret which will get masked from logs
* @param secret value of the secret *
* @param secret - Value of the secret to be masked
* @remarks
* This function instructs the Actions runner to mask the specified value in any
* logs produced during the workflow run. Once registered, the secret value will
* be replaced with asterisks (***) whenever it appears in console output, logs,
* or error messages.
*
* This is useful for protecting sensitive information such as:
* - API keys
* - Access tokens
* - Authentication credentials
* - URL parameters containing signatures (SAS tokens)
*
* Note that masking only affects future logs; any previous appearances of the
* secret in logs before calling this function will remain unmasked.
*
* @example
* ```typescript
* // Register an API token as a secret
* const apiToken = "abc123xyz456";
* setSecret(apiToken);
*
* // Now any logs containing this value will show *** instead
* console.log(`Using token: ${apiToken}`); // Outputs: "Using token: ***"
* ```
*/ */
export function setSecret(secret: string): void { export function setSecret(secret: string): void {
issueCommand('add-mask', {}, secret) issueCommand('add-mask', {}, secret)