mirror of
https://github.com/actions/github-script.git
synced 2026-02-09 03:45:24 +00:00
Move helper method to end of file and revert package-lock.json changes
Co-authored-by: TingluoHuang <1750815+TingluoHuang@users.noreply.github.com>
This commit is contained in:
34
dist/index.js
vendored
34
dist/index.js
vendored
@@ -36258,23 +36258,6 @@ const wrapRequire = new Proxy(require, {
|
||||
|
||||
process.on('unhandledRejection', handleError);
|
||||
main().catch(handleError);
|
||||
/**
|
||||
* Gets the user agent string with orchestration ID appended if available
|
||||
* @param userAgent The base user agent string
|
||||
* @returns The user agent string with orchestration ID appended if ACTIONS_ORCHESTRATION_ID is set
|
||||
*/
|
||||
function getUserAgentWithOrchestrationId(userAgent) {
|
||||
const orchestrationId = process.env['ACTIONS_ORCHESTRATION_ID'];
|
||||
if (!orchestrationId) {
|
||||
return userAgent;
|
||||
}
|
||||
// Sanitize orchestration ID - only keep alphanumeric, dots, hyphens, and underscores
|
||||
const sanitized = orchestrationId.replace(/[^a-zA-Z0-9._-]/g, '');
|
||||
if (!sanitized) {
|
||||
return userAgent;
|
||||
}
|
||||
return `${userAgent} orchestration-id/${sanitized}`;
|
||||
}
|
||||
async function main() {
|
||||
const token = core.getInput('github-token', { required: true });
|
||||
const debug = core.getBooleanInput('debug');
|
||||
@@ -36332,6 +36315,23 @@ function handleError(err) {
|
||||
console.error(err);
|
||||
core.setFailed(`Unhandled error: ${err}`);
|
||||
}
|
||||
/**
|
||||
* Gets the user agent string with orchestration ID appended if available
|
||||
* @param userAgent The base user agent string
|
||||
* @returns The user agent string with orchestration ID appended if ACTIONS_ORCHESTRATION_ID is set
|
||||
*/
|
||||
function getUserAgentWithOrchestrationId(userAgent) {
|
||||
const orchestrationId = process.env['ACTIONS_ORCHESTRATION_ID'];
|
||||
if (!orchestrationId) {
|
||||
return userAgent;
|
||||
}
|
||||
// Sanitize orchestration ID - only keep alphanumeric, dots, hyphens, and underscores
|
||||
const sanitized = orchestrationId.replace(/[^a-zA-Z0-9._-]/g, '');
|
||||
if (!sanitized) {
|
||||
return userAgent;
|
||||
}
|
||||
return `${userAgent} orchestration-id/${sanitized}`;
|
||||
}
|
||||
|
||||
})();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user