Skip to content

Commit c552ebe

Browse files
authored
Merge pull request #44238 from github/repo-sync
Repo sync
2 parents 313608f + d549bd9 commit c552ebe

3 files changed

Lines changed: 25 additions & 25 deletions

File tree

.github/workflows/changelog-agent.lock.yml

Lines changed: 17 additions & 19 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.github/workflows/changelog-agent.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@ on:
3232
DOCS_BOT_PAT: ${{ secrets.DOCS_BOT_PAT_BASE }}
3333
with:
3434
script: |
35-
// Default octokit uses github.token for in-repo (docs-internal) calls
36-
const octokit = github;
35+
// octokit (provided by github-script) uses github.token for in-repo (docs-internal) calls
3736
// Cross-repo octokit uses DOCS_BOT_PAT for docs-content and GraphQL calls
3837
const crossRepoOctokit = github.getOctokit(process.env.DOCS_BOT_PAT);
3938

src/workflows/secondary-ratelimit-retry.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import { RequestError } from '@octokit/request-error'
2-
31
const DEFAULT_SLEEPTIME = parseInt(process.env.SECONDARY_RATELIMIT_RETRY_SLEEPTIME || '30000', 10)
42
const DEFAULT_ATTEMPTS = parseInt(process.env.SECONDARY_RATELIMIT_RETRY_ATTEMPTS || '5', 10)
53

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

0 commit comments

Comments
 (0)