mirror of
https://github.com/actions/github-script.git
synced 2026-04-07 14:49:25 +00:00
Merge branch 'main' into main
This commit is contained in:
commit
b1f2460ad7
3 changed files with 39 additions and 3 deletions
18
dist/index.js
vendored
18
dist/index.js
vendored
|
|
@ -36409,9 +36409,11 @@ async function main() {
|
|||
const retries = parseInt(core.getInput('retries'));
|
||||
const exemptStatusCodes = parseNumberArray(core.getInput('retry-exempt-status-codes'));
|
||||
const [retryOpts, requestOpts] = getRetryOptions(retries, exemptStatusCodes, utils.defaults);
|
||||
const baseUserAgent = userAgent || 'actions/github-script';
|
||||
const finalUserAgent = getUserAgentWithOrchestrationId(baseUserAgent);
|
||||
const opts = {
|
||||
log: debug ? console : undefined,
|
||||
userAgent: userAgent || undefined,
|
||||
userAgent: finalUserAgent,
|
||||
previews: previews ? previews.split(',') : undefined,
|
||||
retry: retryOpts,
|
||||
request: requestOpts
|
||||
|
|
@ -36455,6 +36457,20 @@ 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 - replace invalid characters with underscore
|
||||
const sanitized = orchestrationId.replace(/[^a-zA-Z0-9._-]/g, '_');
|
||||
return `${userAgent} actions_orchestration_id/${sanitized}`;
|
||||
}
|
||||
|
||||
})();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue