feat: expose changed files as {{.Files}} in webhook prompt templates#1565
Open
knechtionscoding wants to merge 1 commit into
Open
feat: expose changed files as {{.Files}} in webhook prompt templates#1565knechtionscoding wants to merge 1 commit into
knechtionscoding wants to merge 1 commit into
Conversation
Kelos already fetches a PR's changed-file list for filePatterns
filtering and then discards it. Expose that list to prompt templates as
{{.Files}} via ExtractGitHubWorkItem. The key is always set so
{{.Files}} never trips missingkey=error; for PR events it is only
populated when a matching filter's filePatterns forced the fetch, while
push events populate it from the payload.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
knechtionscoding
had a problem deploying
to
ok-to-test
July 24, 2026 12:11 — with
GitHub Actions
Error
gjkim42
reviewed
Jul 24, 2026
gjkim42
left a comment
Collaborator
There was a problem hiding this comment.
Looks good, one nit for naming.
| // {{.Files}} never trips missingkey=error) but is only populated when a | ||
| // filter's filePatterns forced a changed-files fetch; otherwise it is | ||
| // empty. See the ChangedFiles field for details. | ||
| "Files": eventData.ChangedFiles, |
Collaborator
There was a problem hiding this comment.
Is it better to name it ChangedFiles?
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.
What type of PR is this?
/kind feature
What this PR does / why we need it:
Kelos already fetches a pull request's changed-file list for
filePatternsfiltering (fetchPRChangedFilesWithTokenininternal/webhook/github_files.go) and then discards it once matching is done. This PR exposes that list to prompt templates as{{.Files}}viaExtractGitHubWorkItem, so spawners can pass the set of touched files into the task prompt without an extra runtimeghcall.Details:
Filesis always present in the template var map so{{.Files}}never trips the renderer'smissingkey=error.filePatternsforced the changed-files fetch (fetching is gated onfilePatterns); otherwise it renders as an empty list.{{.Files}}from the payload regardless.{{range .Files}}.This resolves the "deferred to a follow-up" NOTE previously left on the
ChangedFilesfield. Scope is intentionally limited to.Filesonly —.Diffwould require fetching per-file patch content (larger payloads, truncation concerns) and is left as a future change, consistent with keeping API surfaces minimal.Which issue(s) this PR is related to:
N/A
Special notes for your reviewer:
{{.Files}}for PR events depends onfilePatternsbeing set on the matching filter, because that is the only thing that triggers the lazy fetch. This coupling is documented indocs/reference.md. Adding a.Diffvariable or fetching files when the prompt references{{.Files}}withoutfilePatternsare possible follow-ups.Does this PR introduce a user-facing change?
Summary by cubic
Expose changed file paths to webhook prompt templates as
{{.Files}}so tasks can include touched files without extra GitHub calls. For PRs, it is populated only when a matching filter’sfilePatternstriggered a fetch; push events always provide it from the payload.{{.Files}}(list of paths). Always present; may be empty. Iterate with{{range .Files}}.docs/reference.mdand add tests for rendering and empty behavior.Written for commit eeb26b7. Summary will update on new commits.