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
36 changes: 17 additions & 19 deletions .github/workflows/changelog-agent.lock.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions .github/workflows/changelog-agent.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ on:
DOCS_BOT_PAT: ${{ secrets.DOCS_BOT_PAT_BASE }}
with:
script: |
// Default octokit uses github.token for in-repo (docs-internal) calls
const octokit = github;
// octokit (provided by github-script) uses github.token for in-repo (docs-internal) calls
// Cross-repo octokit uses DOCS_BOT_PAT for docs-content and GraphQL calls
const crossRepoOctokit = github.getOctokit(process.env.DOCS_BOT_PAT);
Expand Down
11 changes: 7 additions & 4 deletions src/workflows/secondary-ratelimit-retry.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { RequestError } from '@octokit/request-error'

const DEFAULT_SLEEPTIME = parseInt(process.env.SECONDARY_RATELIMIT_RETRY_SLEEPTIME || '30000', 10)
const DEFAULT_ATTEMPTS = parseInt(process.env.SECONDARY_RATELIMIT_RETRY_ATTEMPTS || '5', 10)

Expand All @@ -16,9 +14,14 @@ export async function octoSecondaryRatelimitRetry<T>(
try {
return await fn()
} catch (error) {
// Use duck-typing instead of `instanceof RequestError` because octokit
// bundles its own copy of @octokit/request-error in dist-bundle/index.js,
// so the class reference differs from the top-level package and instanceof
// always returns false across the module boundary.
if (
error instanceof RequestError &&
error.status === 403 &&
error instanceof Error &&
'status' in error &&
(error as { status: number }).status === 403 &&
/You have exceeded a secondary rate limit/.test(error.message)
) {
if (tries < attempts) {
Expand Down
Loading