-
Notifications
You must be signed in to change notification settings - Fork 0
chore: set up CI workflow and configure import sorting #42
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
Conversation
WalkthroughAdds a CI GitHub Actions workflow that checks out code, sets up Bun, installs deps, runs format check, lint, and typecheck; removes .prettierrc and introduces prettier.config.js plus three new Prettier plugins in package.json; and applies widespread import reordering and small formatting edits across ~30 source and test files (including a type import addition in src/formatters/command-formatters.ts). No runtime logic or exported API signatures were changed. Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20–25 minutes Areas requiring extra attention:
Possibly related PRs
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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: 0
🧹 Nitpick comments (1)
.github/workflows/ci.yml (1)
1-31: LGTM! CI workflow is well-structured.The workflow correctly sets up automated checks for formatting, linting, and type checking. The use of
--frozen-lockfileensures reproducible builds.Consider adding dependency caching to speed up CI runs:
- name: Setup Bun uses: oven-sh/setup-bun@v2 with: bun-version-file: .bun-version + + - name: Cache dependencies + uses: actions/cache@v4 + with: + path: ~/.bun/install/cache + key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lockb') }} + restore-keys: | + ${{ runner.os }}-bun- - name: Install dependencies run: bun install --frozen-lockfile
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
bun.lockis excluded by!**/*.lock
📒 Files selected for processing (33)
.github/workflows/ci.yml(1 hunks).prettierrc(0 hunks)package.json(2 hunks)prettier.config.js(1 hunks)src/db/index.ts(1 hunks)src/db/schema.ts(1 hunks)src/formatters/command-formatters.ts(1 hunks)src/formatters/events-api.ts(1 hunks)src/formatters/webhook-events.ts(1 hunks)src/github-app/app.ts(1 hunks)src/github-app/event-processor.ts(1 hunks)src/github-app/installation-service.ts(1 hunks)src/github-app/webhook-processor.ts(1 hunks)src/handlers/gh-issue-handler.ts(1 hunks)src/handlers/gh-pr-handler.ts(1 hunks)src/handlers/github-subscription-handler.ts(1 hunks)src/index.ts(1 hunks)src/routes/github-webhook.ts(1 hunks)src/routes/oauth-callback.ts(1 hunks)src/services/github-oauth-service.ts(1 hunks)src/services/oauth-cleanup-service.ts(1 hunks)src/services/polling-service.ts(1 hunks)src/services/subscription-service.ts(1 hunks)src/types/bot.ts(1 hunks)src/utils/oauth-helpers.ts(1 hunks)tests/fixtures/mock-bot-handler.ts(1 hunks)tests/integration/gh-issue-integration.test.ts(1 hunks)tests/integration/gh-pr-integration.test.ts(1 hunks)tests/unit/formatters/events-api.test.ts(1 hunks)tests/unit/handlers/gh-issue-handler.test.ts(1 hunks)tests/unit/handlers/gh-pr-handler.test.ts(1 hunks)tests/unit/handlers/github-subscription-handler.test.ts(1 hunks)tests/unit/types/events-api.test.ts(1 hunks)
💤 Files with no reviewable changes (1)
- .prettierrc
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-11-18T23:35:49.436Z
Learnt from: shuhuiluo
Repo: HereNotThere/bot-github PR: 26
File: src/db/index.ts:61-69
Timestamp: 2025-11-18T23:35:49.436Z
Learning: In `webhook_deliveries` table (src/db/index.ts), the `installation_id` column should NOT have a FOREIGN KEY constraint because the table serves as an immutable audit log for idempotency tracking. Records must persist independently even after installations are deleted, and a foreign key would create race conditions when webhooks arrive before installation records are created. The field is intentionally nullable to support webhooks without installation context.
Applied to files:
src/github-app/installation-service.tssrc/github-app/webhook-processor.ts
🪛 ESLint
src/github-app/installation-service.ts
[error] 1-1: Unable to resolve path to module 'drizzle-orm'.
(import-x/no-unresolved)
src/github-app/webhook-processor.ts
[error] 1-1: Unable to resolve path to module 'drizzle-orm'.
(import-x/no-unresolved)
src/services/oauth-cleanup-service.ts
[error] 1-1: Unable to resolve path to module 'drizzle-orm'.
(import-x/no-unresolved)
src/db/schema.ts
[error] 1-1: Unable to resolve path to module 'drizzle-orm'.
(import-x/no-unresolved)
[error] 13-13: Unable to resolve path to module 'drizzle-orm/pg-core'.
(import-x/no-unresolved)
src/index.ts
[error] 3-3: Unable to resolve path to module '@towns-protocol/bot'.
(import-x/no-unresolved)
src/services/github-oauth-service.ts
[error] 8-8: Unable to resolve path to module '@octokit/rest'.
(import-x/no-unresolved)
[error] 9-9: Unable to resolve path to module 'drizzle-orm'.
(import-x/no-unresolved)
src/github-app/app.ts
[error] 3-3: Unable to resolve path to module '@octokit/webhooks'.
(import-x/no-unresolved)
src/services/subscription-service.ts
[error] 1-1: Unable to resolve path to module 'drizzle-orm'.
(import-x/no-unresolved)
src/db/index.ts
[error] 4-4: Unable to resolve path to module 'drizzle-orm/postgres-js'.
(import-x/no-unresolved)
[error] 5-5: Unable to resolve path to module 'drizzle-orm/postgres-js/migrator'.
(import-x/no-unresolved)
[error] 6-6: Unable to resolve path to module 'postgres'.
(import-x/no-unresolved)
🔇 Additional comments (31)
tests/integration/gh-issue-integration.test.ts (1)
1-2: Formatting-only change looks goodAdding a blank line after the
bun:testimport improves readability and is consistent with the new formatting rules; no behavioral impact.src/utils/oauth-helpers.ts (1)
1-3: Import spacing is consistent and non-functionalThe added blank line between type imports is stylistic only and aligns with the new import formatting; no runtime changes.
src/services/polling-service.ts (1)
1-3: Consistent import spacing; no behavior changeThe extra blank line after the
drizzle-ormimport is a formatting-only tweak that aligns with the new import grouping; PollingService behavior is unchanged.src/types/bot.ts (1)
1-3: Whitespace-only import tweak is fineSeparating the external SDK type import from the local
commandsimport with a blank line is stylistic and has no effect on the exported types.src/github-app/webhook-processor.ts (1)
1-4: Dependency verified; code changes are correct
drizzle-ormis properly installed as a dependency (^0.44.7). The import consolidation is correct and matches actual usage ofeqinisProcessedandltincleanup. The ESLintimport-x/no-unresolvedwarning is a local configuration issue, not a problem with the code itself.src/services/oauth-cleanup-service.ts (1)
1-2: LGTM! Duplicate import removed.The cleanup eliminates the duplicate
ltimport from drizzle-orm, improving code organization.tests/fixtures/mock-bot-handler.ts (1)
2-2: LGTM!Import reordering aligns with the project's import sorting configuration.
src/routes/oauth-callback.ts (1)
2-3: LGTM! Import cleanup.The duplicate
DEFAULT_EVENT_TYPESimport has been removed, keeping a single import at the top.src/db/index.ts (1)
3-6: LGTM! Improved import organization.The imports are now properly grouped with Node.js built-ins separated from third-party packages.
src/handlers/gh-issue-handler.ts (1)
1-17: LGTM! Well-organized imports.The imports are now properly grouped and
classifyApiErroris explicitly imported, improving code clarity.src/formatters/webhook-events.ts (1)
6-16: LGTM! Complete type imports.The addition of
ForkPayloadandIssueCommentPayloadensures all webhook types used in the file are properly imported.src/services/github-oauth-service.ts (1)
1-13: LGTM! Consolidated crypto imports.All crypto-related imports are now consolidated in a single block, and imports are properly grouped by package.
src/db/schema.ts (1)
1-14: LGTM! Explicit and organized imports.The
sqlimport is now separated, and allpg-coreexports are explicitly listed, making the module's dependencies clear.src/formatters/command-formatters.ts (1)
6-11: Import type set and ordering look goodThe GitHub types imported here match the usages below and the reordered list keeps things tidy and consistent with the new import-sorting rules.
tests/unit/types/events-api.test.ts (1)
1-4: Import grouping / spacing is consistentAdding a blank line between the external
bun:testimport and internal module import matches common style and doesn’t affect behavior.src/handlers/github-subscription-handler.ts (1)
1-10: Clean separation of type and value importsGrouping the type-only imports and then importing
stripMarkdownas a value keeps this header consistent with the new formatting rules without affecting behavior.src/routes/github-webhook.ts (1)
1-5: Import spacing aligns with style changesThe added blank line between the external
honoimport and local type imports is a style-only change and keeps imports well grouped.src/github-app/app.ts (1)
1-4: Dependency verified—no issue found@octokit/webhooks is correctly listed in
dependencies(version ^14.1.3) and will resolve normally. The import on line 3 is valid.tests/integration/gh-pr-integration.test.ts (1)
1-2: LGTM!Blank line addition after imports aligns with the new formatting conventions.
package.json (1)
36-50: LGTM!The three new Prettier plugins are appropriate for the import sorting and formatting improvements described in the PR objectives.
tests/unit/handlers/github-subscription-handler.test.ts (1)
1-6: LGTM!Import reorganization follows the new formatting conventions established by the Prettier plugins.
src/formatters/events-api.ts (1)
11-12: LGTM!Import order adjustment aligns with the new import sorting configuration.
tests/unit/handlers/gh-pr-handler.test.ts (1)
1-11: LGTM!Import reorganization is consistent with the new formatting conventions.
src/services/subscription-service.ts (1)
1-6: Import reorganization looks good.The explicit imports from
drizzle-ormand reordering are appropriate. The ESLint error about unresolved path is likely a false positive sincedrizzle-ormis present inpackage.jsondependencies. However, verify that ESLint's import resolver is configured correctly to avoid similar warnings.tests/unit/formatters/events-api.test.ts (1)
1-18: LGTM!Import additions and reordering align with the new formatting configuration.
src/handlers/gh-pr-handler.ts (1)
1-14: LGTM!Import reorganization improves grouping and readability while following the new formatting conventions.
tests/unit/handlers/gh-issue-handler.test.ts (1)
1-12: LGTM! Import reorganization aligns with the new formatting rules.The imports have been properly grouped and sorted according to the new Prettier configuration.
src/index.ts (1)
1-21: LGTM! Import reorganization follows the new formatting conventions.The imports have been properly grouped with third-party modules (
hono,@towns-protocol/bot) separated from local imports.Note: The ESLint error about unresolved module
@towns-protocol/botis a false positive—this is an external dependency.src/github-app/installation-service.ts (1)
1-5: LGTM! Import consolidation improves readability.The drizzle-orm imports are now properly consolidated, and the type-only import for
SubscriptionServiceis correctly used.Note: The ESLint error about unresolved module
drizzle-ormis a false positive—this is an external dependency.src/github-app/event-processor.ts (1)
1-26: LGTM! Import organization is clean and consistent.The formatter imports are properly ordered, and type-only imports are correctly separated for better tree-shaking.
prettier.config.js (1)
1-23: LGTM! Prettier configuration is well-structured.The import order configuration provides clear grouping:
- Node built-ins (
^node:)- Third-party modules
- Towns Protocol modules (
^@towns-protocol/(.*)$)- Path aliases (
^@/)- Relative imports (
^[./])This hierarchy makes sense and will keep imports organized consistently across the codebase.
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.