mirror of
https://github.com/actions/github-script.git
synced 2026-01-10 11:43:08 +00:00
Compare commits
1 Commits
main
...
dependabot
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
16bb73edcf |
2
.github/workflows/integration.yml
vendored
2
.github/workflows/integration.yml
vendored
@@ -167,7 +167,7 @@ jobs:
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
echo "- Validating user-agent set to an empty string"
|
echo "- Validating user-agent set to an empty string"
|
||||||
expected="actions/github-script octokit-core.js/"
|
expected="octokit-core.js/"
|
||||||
if [[ "${{steps.user-agent-empty.outputs.result}}" != "$expected"* ]]; then
|
if [[ "${{steps.user-agent-empty.outputs.result}}" != "$expected"* ]]; then
|
||||||
echo $'::error::\u274C' "Expected user-agent to start with '$expected', got ${{steps.user-agent-empty.outputs.result}}"
|
echo $'::error::\u274C' "Expected user-agent to start with '$expected', got ${{steps.user-agent-empty.outputs.result}}"
|
||||||
exit 1
|
exit 1
|
||||||
|
|||||||
2
.github/workflows/licensed.yml
vendored
2
.github/workflows/licensed.yml
vendored
@@ -19,7 +19,7 @@ jobs:
|
|||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0 # prefer to use a full fetch for licensed workflows
|
fetch-depth: 0 # prefer to use a full fetch for licensed workflows
|
||||||
- uses: ruby/setup-ruby@354a1ad156761f5ee2b7b13fa8e09943a5e8d252 # v1.229.0
|
- uses: ruby/setup-ruby@d697be2f83c6234b20877c3b5eac7a7f342f0d0c # v1.269.0
|
||||||
with:
|
with:
|
||||||
ruby-version: ruby
|
ruby-version: ruby
|
||||||
- uses: github/setup-licensed@v1
|
- uses: github/setup-licensed@v1
|
||||||
|
|||||||
18
dist/index.js
vendored
18
dist/index.js
vendored
@@ -36267,11 +36267,9 @@ async function main() {
|
|||||||
const retries = parseInt(core.getInput('retries'));
|
const retries = parseInt(core.getInput('retries'));
|
||||||
const exemptStatusCodes = parseNumberArray(core.getInput('retry-exempt-status-codes'));
|
const exemptStatusCodes = parseNumberArray(core.getInput('retry-exempt-status-codes'));
|
||||||
const [retryOpts, requestOpts] = getRetryOptions(retries, exemptStatusCodes, utils.defaults);
|
const [retryOpts, requestOpts] = getRetryOptions(retries, exemptStatusCodes, utils.defaults);
|
||||||
const baseUserAgent = userAgent || 'actions/github-script';
|
|
||||||
const finalUserAgent = getUserAgentWithOrchestrationId(baseUserAgent);
|
|
||||||
const opts = {
|
const opts = {
|
||||||
log: debug ? console : undefined,
|
log: debug ? console : undefined,
|
||||||
userAgent: finalUserAgent,
|
userAgent: userAgent || undefined,
|
||||||
previews: previews ? previews.split(',') : undefined,
|
previews: previews ? previews.split(',') : undefined,
|
||||||
retry: retryOpts,
|
retry: retryOpts,
|
||||||
request: requestOpts
|
request: requestOpts
|
||||||
@@ -36315,20 +36313,6 @@ function handleError(err) {
|
|||||||
console.error(err);
|
console.error(err);
|
||||||
core.setFailed(`Unhandled 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}`;
|
|
||||||
}
|
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
|
||||||
|
|||||||
22
src/main.ts
22
src/main.ts
@@ -39,12 +39,9 @@ async function main(): Promise<void> {
|
|||||||
defaultGitHubOptions
|
defaultGitHubOptions
|
||||||
)
|
)
|
||||||
|
|
||||||
const baseUserAgent = userAgent || 'actions/github-script'
|
|
||||||
const finalUserAgent = getUserAgentWithOrchestrationId(baseUserAgent)
|
|
||||||
|
|
||||||
const opts: Options = {
|
const opts: Options = {
|
||||||
log: debug ? console : undefined,
|
log: debug ? console : undefined,
|
||||||
userAgent: finalUserAgent,
|
userAgent: userAgent || undefined,
|
||||||
previews: previews ? previews.split(',') : undefined,
|
previews: previews ? previews.split(',') : undefined,
|
||||||
retry: retryOpts,
|
retry: retryOpts,
|
||||||
request: requestOpts
|
request: requestOpts
|
||||||
@@ -99,20 +96,3 @@ function handleError(err: any): void {
|
|||||||
console.error(err)
|
console.error(err)
|
||||||
core.setFailed(`Unhandled 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: string): string {
|
|
||||||
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}`
|
|
||||||
}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user