Closed
feat: extract pkg/ghexpr — deduplicated GitHub Actions expression parsing package#45910
Conversation
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot
AI
changed the title
feat: extract pkg/ghexpr expression parsing package and fix duplicates
feat: extract pkg/ghexpr — deduplicated GitHub Actions expression parsing package
Jul 16, 2026
Copilot created this pull request from a session on behalf of
pelikhan
July 16, 2026 05:09
View session
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.
GitHub Actions expression parsing logic (AST nodes, tokenizer, parser, optimizer, patterns, builders) was spread across 9 files in
pkg/workflowwith no clear ownership boundary and several obvious pattern duplicates.New
pkg/ghexprpackagePure expression-parsing infrastructure extracted into a standalone package with full spec documentation:
nodes.goConditionNode,AndNode,OrNode,NotNode,DisjunctionNode,FunctionCallNode,PropertyAccessNode,StringLiteralNode,BooleanLiteralNode,ComparisonNode)parser.goParseExpression,VisitExpressionTree,BreakLongExpression,StripExpressionWrapper, YAML string helpersoptimizer.gopatterns.goHasExpressionMarker/ContainsExpression/IsExpressionpredicatesbuilder.goBuildAnd,BuildOr,BuildEquals,RenderCondition, …)doc.goTests:
parser_test.go,optimizer_test.go,builder_test.go,patterns_test.go, plus white-box internal tests (optimizer_white_box_test.go,parser_white_box_test.go).pkg/workflow— backward-compatible delegationAll 38+ existing files in
pkg/workflowcontinue to compile unchanged via Go type aliases and function var aliases:expression_patterns.gore-exports core patterns fromghexprand retains only gh-aw–specific context patterns (AWInputsPattern,SecretsExpressionPattern, etc.).Duplicate patterns eliminated
expression_syntax_validation.gostringLiteralRegex,numberLiteralRegexghexpr.StringLiteralPattern,ghexpr.NumberLiteralPatternexpression_safety_validation.goorExpressionPattern(identical toOrPattern)ghexpr.OrPatternpublish_assets.gogithubExpressionPattern = regexp.MustCompile(...)ghexpr.IsExpression(value)Internal white-box tests that directly accessed unexported optimizer/parser symbols are migrated to
pkg/ghexpraspackage ghexpr(non-_test) files.