feat(executor): implement template interpolation #185
No reviewers
Labels
No labels
Compat/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Status
Abandoned
Status
Blocked
Status
Need More Info
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
thwap/ttheart!185
Loading…
Reference in a new issue
No description provided.
Delete branch "feature/implement-template-interpolation"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
Implement command template interpolation in
internal/executor/template.go:Interpolate()renders Gotext/templatecommands with webhook payload as context (#65, #66){{ json .field }}— JSON-marshals a value{{ timestamp }}— RFC3339 UTC timestamp{{ quote .field }}— shell-safe single-quoted stringquotefunction (#68)<no value>(Go default)Why
Commands in config need to reference webhook payload data dynamically. Template interpolation bridges the parsed payload and the shell command to be executed.
Testing
go test ./...and pre-commit passtemplate_test.goBreaking Changes
None.
Notes
quoteescapes internal single quotes using'\''pattern{{ .repository.full_name }})Closes #69
Closes #65
Closes #66
Closes #67
Closes #68
Review
Clean template interpolation implementation. Lint, vet, all 7 tests pass.
Design highlights:
text/templatewith 3 custom functions:json,timestamp,quotequoteuses POSIX-correct single-quote escaping ('o'\''brien'pattern) — prevents shell injectionjsonhandles any value viainterface{}— works with nested maps, strings, numberstimestampreturns RFC3339 UTC — no arguments, deterministicTests: 7 tests covering basic interpolation, all 3 functions, quoting edge case with embedded single quote, invalid template (parse error), and missing field placeholder.
No blocking issues.
APPROVED