-
Notifications
You must be signed in to change notification settings - Fork 78
fix: replaces fetch API with octokit.getContent #2570
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
| "@cosmjs/tendermint-rpc": "~0.36.1", | ||
| "@dotenvx/dotenvx": "^1.9.0", | ||
| "@hono/node-server": "1.13.7", | ||
| "@hono/otel": "~0.4.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔄 Carefully review the package-lock.json diff
Resolve the comment if everything is ok
* node_modules/@octokit/auth-token 2.5.0 -> 6.0.0
* node_modules/@octokit/endpoint 6.0.12 -> 11.0.2
* node_modules/@octokit/graphql 4.8.0 -> 9.0.3
* node_modules/@octokit/openapi-types 12.11.0 -> 27.0.0
* node_modules/@octokit/plugin-paginate-rest 2.21.3 -> 14.0.0
* node_modules/@octokit/plugin-request-log 1.0.4 -> 6.0.0
* node_modules/@octokit/plugin-rest-endpoint-methods 5.16.2 -> 17.0.0
* node_modules/@octokit/request-error 2.1.0 -> 7.1.0
* node_modules/@octokit/request 5.6.3 -> 10.0.7
* node_modules/@octokit/rest 18.12.0 -> 22.0.1
* node_modules/@octokit/types 6.41.0 -> 16.0.0
+ node_modules/@octokit/core/node_modules/before-after-hook 4.0.0
+ node_modules/@octokit/request/node_modules/universal-user-agent 7.0.3
+ node_modules/fast-content-type-parse 3.0.0
- apps/api/node_modules/@swc/helpers 0.5.18
- node_modules/git-semver-tags/node_modules/conventional-commits-filter 5.0.0
- node_modules/git-semver-tags/node_modules/conventional-commits-parser 6.2.1
- node_modules/tsup/node_modules/yaml 2.8.2
📝 WalkthroughWalkthroughThe PR upgrades Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
Comment |
❌ 17 Tests Failed:
View the top 3 failed test(s) by shortest run time
To view more test analytics, go to the Test Analytics Dashboard |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
apps/api/src/template/services/template-fetcher/template-fetcher.service.ts (1)
83-101: Add type guard for response.data in fetchFileContent
mediaType.format="raw"is the correct way to fetch raw content in Octokit v22, butString(response.data)can mask errors if the response unexpectedly returns a non-string value. Add a type check before returning, matching the pattern used infetchDirectoryContent:Suggested change
- if (response.status !== 200) { - throw new Error(`Failed to fetch content from ${owner}/${repo}/${path}`); - } - - return String(response.data); + if (response.status !== 200 || typeof response.data !== "string") { + throw new Error(`Failed to fetch content from ${owner}/${repo}/${path}`); + } + + return response.data;
🤖 Fix all issues with AI agents
In `@apps/api/package.json`:
- Line 66: The dependency bump to "@octokit/rest": "^22.0.1" requires Node.js
≥20 and ESM-first imports; verify the runtime and code accordingly by ensuring
the project's Node target is >=20 (update runtime config/CI), convert any
CommonJS requires of "@octokit/rest" to ESM-style imports (e.g., replace
require(...) with import { Octokit } from "@octokit/rest" where used), and if
this is a TypeScript project update tsconfig.json (adjust "module" and
"moduleResolution" to "node16" or "nodenext" as appropriate) so TypeScript
resolves the package's conditional exports; check all usages of Octokit and
build/CI settings to prevent runtime import/resolution failures.
| "@hono/swagger-ui": "0.4.1", | ||
| "@hono/zod-openapi": "0.18.4", | ||
| "@octokit/rest": "^18.12.0", | ||
| "@octokit/rest": "^22.0.1", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🌐 Web query:
@octokit/rest v22 breaking changes Node.js requirements
💡 Result:
@octokit/rest v22 effectively raises the minimum Node.js version to 20+ (i.e., Node 18 is no longer supported), because the v22 line updates to the latest Octokit monorepo major, which pulls in dependencies like @octokit/core@7 that declare engines: { node: ">= 20" }. [1][2]
Other practical “breaking” upgrade notes you’re likely to hit moving to v22:
- ESM import usage is the documented/default usage (
import { Octokit } from "@octokit/rest";), notrequire(...). [3] - Because the package uses conditional exports, TypeScript projects may need
tsconfig.jsonupdates ("moduleResolution": "node16"and"module": "node16"). [4]
Sources:
[1] https://app.unpkg.com/%40octokit/core%407.0.5/files/package.json
[2] https://github.com/octokit/rest.js/releases/tag/v22.0.1
[3] https://octokit.github.io/rest.js/v22/
[4] https://github.com/octokit/rest.js/
Verify Node.js 20+ requirement and ESM compatibility before merging
v22 is a breaking change:
- Minimum Node.js version: Raises requirement from 18 to 20+ (v22 depends on
@octokit/core@7 which requires Node ≥ 20) - Module system: ESM imports (
import { Octokit } from "@octokit/rest") are now the default; CommonJSrequire()usage is not the documented path - TypeScript projects: May need
tsconfig.jsonupdates ("moduleResolution": "node16"and"module": "node16") due to conditional exports
Confirm the app's Node.js target version supports 20+, verify ESM imports are correct, and update TypeScript config if needed.
🤖 Prompt for AI Agents
In `@apps/api/package.json` at line 66, The dependency bump to "@octokit/rest":
"^22.0.1" requires Node.js ≥20 and ESM-first imports; verify the runtime and
code accordingly by ensuring the project's Node target is >=20 (update runtime
config/CI), convert any CommonJS requires of "@octokit/rest" to ESM-style
imports (e.g., replace require(...) with import { Octokit } from "@octokit/rest"
where used), and if this is a TypeScript project update tsconfig.json (adjust
"module" and "moduleResolution" to "node16" or "nodenext" as appropriate) so
TypeScript resolves the package's conditional exports; check all usages of
Octokit and build/CI settings to prevent runtime import/resolution failures.
5abf336 to
3b3876f
Compare
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
Why
in order to use the GH_TOKEN to fetch files content because direct
fetchAPI call timeouts sometimesSummary by CodeRabbit
Chores
Tests
✏️ Tip: You can customize this high-level summary in your review settings.