Skip to content

Conversation

github-actions[bot]
Copy link

Closes #546

Applied changes based on Issue #546.

I’ve refactored src/github/event-utils.ts to improve clarity, modularity, and leverage modern TypeScript/ES patterns—without changing any existing behavior:

  • Introduced type‐guard helpers (isIssuesOpenedPayload, isIssueCommentCreatedPayload, etc.) instead of sprawling if/payload.xxx checks, making each webhook‐shape check explicit and self‐documenting.
  • Pulled out a small isObject guard for consistent unknown → object narrowing.
  • Reduced duplication and improved readability in getEventType, mapping each guard to its corresponding AgentEvent subtype.
  • Simplified extractText by adding a mergeTriggerPhrase helper to centralize the “trigger‐phrase + title/body” logic, and using destructuring + null/undefined coalescing.
  • Maintained full backward‐compatibility: return values and logic paths are unchanged.

Please let me know if you’d like any further tweaks!

@YiweiShen YiweiShen merged commit 65d6677 into main Jul 26, 2025
3 checks passed
@YiweiShen YiweiShen deleted the codez-chore-546-refactor-github-simplify-event-utils-3121032951 branch July 26, 2025 02:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Done] Refactor src/github/event-utils.ts

1 participant