feat(report): support --report for single export commands#3
Conversation
Extend --report flag injection from batch-only to all export commands (colors, icons, images, typography). Parse both BatchReport and ExportReport formats via structural discrimination in parseReportFile(). Closes #2 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ests Break monolithic try/catch in parseReportFile into separate stages (file read, JSON parse, format discrimination) with core.warning at each level. Strengthen report format discrimination with type guards (Array.isArray, typeof checks). Add defensive null guard for stats in parseSingleReport. Reuse BatchConfigStats in ExportReport type. Fix misleading "Report file not found" warning message. Add 6 new tests covering edge cases: unrecognized format, discriminator precedence, single-report error truncation, null error on failure, multi-stat summation, and custom report path for single exports. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Summary of ChangesHello @alexey1312, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly enhances the action's reporting capabilities by extending the Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request extends the --report functionality to single export commands, which was previously only available for batch mode. This is achieved by introducing a new ExportReport type and a parser for this new report format. The main report parsing logic in parseReportFile has been refactored to be more robust, with better error handling and logic to discriminate between batch and single command reports. The changes are well-tested with new unit tests covering various scenarios for the new functionality. My review found one minor inconsistency in a type definition, for which I've provided a suggestion.
| duration: number; | ||
| success: boolean; | ||
| error: string | null; | ||
| stats: BatchConfigStats; |
There was a problem hiding this comment.
The stats property is defined as non-nullable (BatchConfigStats), but the implementation in src/index.ts handles cases where it might be null or undefined. For example, parseReportFile checks report.stats != null, and parseSingleReport uses a nullish coalescing operator (report.stats ?? ...).
To make the type definition consistent with the implementation, stats should be nullable. This also aligns with the BatchConfigReport type where stats is already defined as BatchConfigStats | null.
| stats: BatchConfigStats; | |
| stats: BatchConfigStats | null; |
Summary
--reportflag support from batch-only to all export commands (colors,icons,images,typography)ExportReporttype andparseSingleReport()for single-command structured JSON reportsparseReportFile()with granular error handling, type-guarded format discrimination, and defensive null checksBatchConfigStatsinExportReportto eliminate type duplicationTest plan
--reportflag is injected forcolors/icons/images/typographycommandsreport_jsonoutput is populated🤖 Generated with Claude Code