Conversation
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot created this pull request from a session on behalf of
pelikhan
March 15, 2026 01:40
View session
pelikhan
reviewed
Mar 15, 2026
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Improves performance and resilience of workflow name extraction by scanning markdown for the first H1 header without fully parsing YAML frontmatter.
Changes:
- Added
fastParseTitleto quickly find the first#title while skipping optional frontmatter. - Updated
extractWorkflowNameFromFileto use the fast title scanner instead of full frontmatter parsing. - Added unit tests covering
fastParseTitlebehavior across frontmatter/no-frontmatter and error cases.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| pkg/cli/workflows.go | Introduces a lightweight markdown title scan and wires it into workflow name extraction. |
| pkg/cli/commands_utils_test.go | Adds targeted unit tests validating title parsing behavior and edge cases. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
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.
extractWorkflowNameFromFilewas callingparser.ExtractFrontmatterFromContent, which runs a fullyaml.Unmarshal— entirely wasted work when the function only needs to skip the frontmatter block and scan for the first#header.Changes
pkg/cli/workflows.go: Extracted the lightweight line-scanning logic into a newfastParseTitle(content string) (string, error)function. It skips frontmatter delimiters without YAML parsing and returns the first H1 title. Frontmatter is only recognised when---appears on the first line (preserving original semantics). Unclosed frontmatter still returns an error.extractWorkflowNameFromFilenow delegates tofastParseTitle.pkg/cli/commands_utils_test.go: AddedTestFastParseTitlewith 10 table-driven test cases covering: H1 after frontmatter, trailing spaces, no frontmatter, H1 as first line, no H1 header, only H2 headers, empty content, unclosed frontmatter error, mid-content---delimiter, and H1 inside a frontmatter block.Benchmark: ~19,000 ns/op → ~11,500 ns/op (~40% improvement)
🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.