Prepend emails to top of document instead of appending to bottom - #23
Merged
Conversation
Co-authored-by: don-petry <36422719+don-petry@users.noreply.github.com>
Co-authored-by: don-petry <36422719+don-petry@users.noreply.github.com>
Co-authored-by: don-petry <36422719+don-petry@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix gmail-to-drive to prepend content to document
Prepend emails to top of document instead of appending to bottom
Feb 8, 2026
don-petry
marked this pull request as ready for review
February 8, 2026 02:28
Contributor
There was a problem hiding this comment.
Pull request overview
Updates gmail-to-drive-by-labels so newly processed email content is inserted at the top of the target Google Doc, aiming to make the most recent content visible without scrolling.
Changes:
- Switches document writes from
appendParagraph(...)toinsertParagraph(0/idx, ...)to prepend each email block. - Extends the DocumentApp test mock with
insertParagraph(childIndex, text)support. - Adds new Jest tests intended to validate newest-first ordering and attachment listing with prepend behavior, and updates README wording.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
src/gmail-to-drive-by-labels/code.gs |
Changes message rendering to use insertParagraph with a per-message index to prepend content. |
test-utils/mocks.js |
Adds insertParagraph support to the Document body mock for tests. |
src/gmail-to-drive-by-labels/tests/prepend-behavior.test.js |
Adds unit-style tests around paragraph ordering when inserting at the top. |
src/gmail-to-drive-by-labels/tests/integration.test.js |
Adds integration-style tests simulating the email processing flow with prepend behavior. |
src/gmail-to-drive-by-labels/README.md |
Updates documentation to reflect prepend/newest-first behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…add bounds checking Co-authored-by: don-petry <36422719+don-petry@users.noreply.github.com>
…tion Co-authored-by: don-petry <36422719+don-petry@users.noreply.github.com>
Co-authored-by: don-petry <36422719+don-petry@users.noreply.github.com>
Collaborator
|
@copilot - Code coverage test is failing. Add more tests until it passes. |
Co-authored-by: don-petry <36422719+don-petry@users.noreply.github.com>
Contributor
Author
Fixed in commit e1098e4. Added 9 new comprehensive tests covering all previously uncovered code paths including:
All coverage requirements now met:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.