Skip to content

Auto-generated Pull Request for feat/issue-label-email#202

Open
github-actions[bot] wants to merge 71 commits intodevelopfrom
feat/issue-label-email
Open

Auto-generated Pull Request for feat/issue-label-email#202
github-actions[bot] wants to merge 71 commits intodevelopfrom
feat/issue-label-email

Conversation

@github-actions
Copy link
Copy Markdown

Pulling 'feat/issue-label-email into develop. Please review and merge.

ktun95 added 30 commits January 16, 2026 11:23
This commit introduces a new command, `issue-label-email`, to send emails based on issue labels. It also includes HTML parsing functionality to extract data from issue bodies.
This commit introduces functionality to extract data from issue
descriptions using regular expressions and templates. It includes
functions to extract order IDs and email addresses from text, as well
as a generic function to extract data based on a provided template.
The commit also includes tests to verify the extraction logic.
This commit introduces a new issue template used for generating order reports. The template includes sections for shipping and billing information, stocks ordered, strain information, strain storage, plasmid information and storage, and comments. It uses data passed to it to populate the fields.
The changes introduce an `IssueProcessor` struct to encapsulate issue
processing logic, including extracting order data from the issue body.
This improves code organization and readability. The `extractOrderData`
method is added to parse the issue body and populate the `orderData`
field. Additionally, the `getIssueBody` function is added to retrieve
the issue body from GitHub using the Issues API.
The issue.json file contains data representing a GitHub issue. This file will be used for integration testing to ensure that the application correctly processes and interacts with issue data from the GitHub API.
Added functions to extract order ID and billing email from the issue body,
including `extractOrderIDFromBody`, `extractBillingEmailFromBody`, and
`extractFromBody`. Also renamed `extractOrderID` to `extractOrderIDFromTitle`
and `extractEmail` to `extractEmailFromTitle` to clarify their purpose.
`extractWithRegex` was renamed to `extractFromTitle`.
These functions extract information from the issue body using regular
expressions, specifically targeting the order ID and billing email.
The new functions allow extracting the order ID and email from the body
of the issue, which is necessary when the information is not available
in the title.
Added a new test function, TestExtractFromBody, to verify the functionality of extracting data from the issue body. This includes reading a test data file, parsing JSON to extract the body, and asserting that the data extraction is successful.
…actWithRegex to extractFromBody

The function names were changed to follow the naming convention for private methods in Go, which are not exported and should start with a lowercase letter. This improves code readability and maintainability by clearly indicating the scope of these functions within the package.
The URL creation in the `getIssueBodyHTML` function is simplified by using the `owner` and `repo` variables. This improves readability and maintainability of the code.
The OrderData struct and IssueProcessor struct were moved from the issue package to the extract package to improve code organization and modularity. This change encapsulates data extraction logic within its own package, promoting better separation of concerns.
The extractFromTemplate function was removed as it was not being used
anywhere in the codebase, which reduces code complexity.
This change adds a new route to the fake HTTP server that allows fetching an issue by its number. This is necessary for testing functionality that relies on retrieving specific issues.
…HTML

This commit introduces two new functions: `ExtractBillingEmail` and
`ExtractOrderID`. `ExtractBillingEmail` parses HTML to find a table
with a "Billing Address" header and extracts the email from that
column. `ExtractOrderID` finds a paragraph containing "Order ID" and
extracts the order ID value. These functions use regular expressions
to reliably extract the required information.
…eTableBody, and parseTableRow functions

The comments for `parseTable`, `parseTableHead`, `parseTableBody`, and `parseTableRow` functions are updated to end with a period for consistency and improved readability.
This commit introduces parser_test.go, which includes tests for parsing tables, extracting billing emails, and extracting order IDs from HTML content. The tests use data from testdata/issue.json to verify the correctness of the parsing functions.
The commit refactors the issue retrieval process by using a fake GitHub server and client for testing. This eliminates the need for multiple test functions with different flag configurations. The new test function, TestGetIssue, sets up a fake server, creates a CLI context with the necessary flags, and calls the getIssue function. It then asserts that the retrieved issue data matches the expected values from the issue.json file.
…ument

The getIssueBody function was refactored to accept a *github.Issue as an argument instead of *cli.Context. This change improves modularity and testability by decoupling the function from the CLI context. A new getIssue function was introduced to fetch the issue from GitHub using the client and context, which is then passed to getIssueBody. The IssueLabelEmail function was moved to the end of the file.
The TestExtractFromTemplate test was removed because it was no longer relevant to the current functionality. The extractFromTemplate function was refactored, and this test did not align with the updated implementation.
The extract tests now include assertions to validate the extracted order ID and email address, ensuring the extraction logic functions correctly. The logging statements were removed to keep the test output clean and focused on test results.
The github.com/yuin/goldmark dependency added to the project for parsing
markdown to html.
The changes implement the IssueLabelEmail function, which fetches an issue, converts its markdown body to HTML, extracts the order ID and billing email from the HTML, and logs the extracted data. It uses the htmlparser package for HTML conversion and data extraction.
The new function uses the goldmark library with GitHub Flavored Markdown extensions to convert markdown text to HTML. This allows the application to render markdown content as HTML.
The github client has been upgraded to v62 to use the latest features and improvements. The legacy client has been removed to reduce code duplication and simplify the codebase. The GetBranch function in deploy.go now accepts maxRedirects as a parameter.
…order data extraction

The ParseTables, ExtractBillingEmail, and ExtractOrderID functions now accept a *html.Node as input instead of an HTML string. The MarkdownToHTML function now returns a *html.Node instead of an HTML string. Added extractOrderData function to extract order data from html node. This change improves the efficiency and flexibility of the HTML parsing logic.
`parser` better reflects the overall purpose of the package.
The package was renamed from `html` to `parser` to more accurately reflect its purpose, which is to parse HTML rather than represent the entire HTML structure. This change improves code readability and maintainability by providing a more descriptive name.
…ckage to send order update

The htmlparser package was renamed to parser to better reflect its purpose. The email sending logic was moved to a separate email package for better organization and reusability. The IssueLabelEmail function now uses the email package to send order update emails.
The new email template is added to send order status updates to users. The template includes basic HTML styling and placeholders for order ID and status label.
This commit introduces the functionality to send emails using Mailgun. It includes the creation of an EmailClient struct, configuration settings, template rendering, and functions for sending order update emails. The implementation supports sending emails from a template and directly with HTML content.
The change replaces the method call `ec.mg.NewMessage` with the package function `mailgun.NewMessage` to create a new message. This aligns with the intended usage of the Mailgun package and removes the dependency on the EmailClient's Mailgun instance for message creation. Additionally, the method `message.SetHtml` is replaced with `message.SetHTML` to align with the mailgun library.
The issueid flag was incorrectly defined as a StringFlag, but it represents the ID of an issue, which is an integer. This commit corrects the flag type to IntFlag to ensure that the issue ID is properly parsed and handled as an integer.
The logging in the SendIssueLabelEmail function was refactored to use structured logging with fields for order ID, recipient email, and label. This provides more context and makes it easier to search and analyze logs. Additionally, error logging was added to capture failures in sending emails, and success logging was added to confirm successful email dispatches.
The email and order ID regex patterns are now precompiled and stored as global variables. This improves performance by avoiding recompilation of the same regex patterns each time the extraction functions are called.
This commit introduces the `MarkdownToHTML` function, which converts markdown to HTML using the `github.com/yuin/goldmark` library. Comprehensive test cases are included to verify correct parsing of various markdown elements such as paragraphs, headers, bold text, GFM tables, and links. The tests ensure that the generated HTML contains the expected elements and attributes.
…rage

This commit adds new test cases for the getIssueBody function, including tests for valid, empty, nil, whitespace-only, and multiline bodies. This increases test coverage and ensures the function handles various scenarios correctly, especially edge cases like empty or nil issue bodies.
…tion

This commit refactors the `SendIssueLabelEmail` function to extract and validate order data using a new function `extractAndValidateOrderData`. This improves code readability and maintainability by separating the data extraction and validation logic from the main function. Additionally, unit tests were added to ensure the new function works as expected.
This commit introduces tests to validate the email template fields against the OrderEmailData struct and to verify the HTML creation process for order update emails. The tests ensure that all template fields exist in the struct and that the generated HTML contains the expected content and structure.
@ktun95 ktun95 requested a review from cybersiddhu February 18, 2026 17:45
The resp variable was assigned the response from the Mailgun API but was never used, so it has been removed to clean up the code.
The API key is no longer stored in the MailgunConfig struct, as it is not needed there. The Mailgun client is initialized with the API key directly, so storing it in the config struct is redundant.
The arguments in the NewEmailClient function were in the wrong order, with the apiKey being passed before the fromEmail. This commit corrects the order to match the expected order of arguments.
@ktun95 ktun95 force-pushed the feat/issue-label-email branch from 8b1fd22 to c02de05 Compare February 18, 2026 18:03
The apiKey flag was moved to be the first flag in the list. This change improves the organization and readability of the command-line flags, making it easier for users to understand the required parameters.
The order of the flags has been adjusted to group related options together, improving readability and maintainability. The 'label' flag is moved after 'issueid' to follow a more logical sequence.
@ktun95 ktun95 force-pushed the feat/issue-label-email branch from 815655d to 26aebc3 Compare February 18, 2026 20:16
@ktun95 ktun95 requested review from ktun95 and removed request for cybersiddhu February 19, 2026 18:13
@github-actions
Copy link
Copy Markdown
Author

Review Request Workflow Status

⚠️ Review request skipped - All required checks must be passing before requesting a review.

Current Status:

  • Check Status: Pending
  • Cannot proceed with review request until all checks pass

Please ensure all continuous integration checks (tests, linting, coverage, etc.) pass before the workflow can request a review.


This is an automated message from the Request Review Workflow

Generated by Request Review on PR (Automatic) for issue #202

@ktun95 ktun95 force-pushed the feat/issue-label-email branch 2 times, most recently from 26aebc3 to 9ff9edc Compare February 20, 2026 14:06
…e 122

The tests and associated testdata have been updated to use issue number 122 instead of 193. This includes updating the issue number, title, and content verifications in the tests, as well as the contents of the issue.json file. The number of tables extracted from the HTML was also updated. This ensures that the tests are accurate and reflect the current state of the application.
This commit modifies the email sending process to include stock data
(strains and plasmids) in the order update emails. The
OrderEmailData struct is updated to include a StockData field, and
the email template is modified to display the stock data. The
SendOrderUpdateFromTemplate function in email.go now accepts the
OrderEmailData struct directly, instead of the recipient email as a
separate argument. The email template test has been updated to
exclude iteration-scoped fields.

The changes allow users to receive detailed information about the
strains and plasmids they ordered, improving the user experience.
The order update email template was completely rewritten to improve the user experience. The new template includes a modern design, better readability, and more detailed information about the order status and items. The email is now more visually appealing and easier to understand.
This commit introduces functionality to extract strain and plasmid
information from HTML content within an order. It includes new
structs for representing strain and plasmid data, functions for
parsing tables, and logic to identify and extract relevant
information. The ExtractOrderData function is updated to include
stock data extraction. Tests are added to verify the extraction
process.
The issue template file was removed as it is no longer needed.
The order update email template has been improved with better styling and clearer information presentation. The test coverage has been expanded to include more scenarios and a table-driven approach for easier maintenance and readability. The padding in the email template has been adjusted for better spacing on smaller screens.
@ktun95 ktun95 requested review from cybersiddhu and removed request for cybersiddhu and ktun95 February 20, 2026 16:21
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.

1 participant