Skip to content

feat: route inbound emails to GitHub issues, adding thread replies as comments - #867

Draft
vcnainala wants to merge 1 commit into
developmentfrom
feat/email-to-issue
Draft

vcnainala wants to merge 1 commit into
developmentfrom
feat/email-to-issue

Conversation

@vcnainala

Copy link
Copy Markdown
Member

Replaces the Zapier "Add new inbound emails to GitHub as new issues" Zap, which created a new issue for every reply because it matched on the raw subject (`Re: ...`).

How it works

  • `deployment/email-relay`: a Cloudflare Email Worker. It parses the incoming email, strips quoted reply history, and triggers the workflow via `workflow_dispatch`. An optional `ALLOWED_SENDERS` allowlist is supported.
  • `.github/workflows/email-to-issue.yml`: removes `Re:`/`Fwd:`/`AW:`/`WG:` prefixes from the subject and searches open issues for an exact title match. If one is found, the email is added as a comment (sender + text); otherwise a new issue is created.

Setup (after this reaches `main`; workflow_dispatch only works for workflows on the default branch)

  1. Create a fine-grained PAT scoped to `Steinbeck-Lab/coconut` with Actions: Read and write.
  2. `cd deployment/email-relay && npm install && npx wrangler secret put GITHUB_TOKEN && npx wrangler deploy`
  3. In Cloudflare Email Routing for the domain, add a custom address (e.g. `issues@`) with action Send to a Worker → `coconut-email-relay`.
  4. Point senders/forwarding at that address and turn the Zap off.

Testing

  • Locally: the worker was run against a sample reply email (subject normalized, quoted history removed, allowlist rejection) and `wrangler deploy --dry-run` builds.
  • Workflow: can be run manually from the Actions tab with a subject/body once on `main`.

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 22.74%. Comparing base (a4c26c6) to head (84aa620).
⚠️ Report is 26 commits behind head on development.

Additional details and impacted files
@@                Coverage Diff                 @@
##             development     #867       +/-   ##
==================================================
+ Coverage           6.14%   22.74%   +16.59%     
- Complexity          1736     2361      +625     
==================================================
  Files                227      261       +34     
  Lines               8945    11137     +2192     
==================================================
+ Hits                 550     2533     +1983     
- Misses              8395     8604      +209     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

This branch has not been deployed

No deployments
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.

2 participants