feat(#1575): populate PR body from target repo's PR template#2122
feat(#1575): populate PR body from target repo's PR template#2122fullsend-ai-coder[bot] wants to merge 1 commit into
Conversation
When creating PRs, post-code.sh now checks for .github/PULL_REQUEST_TEMPLATE.md (and other GitHub-supported locations) in the target repo. If found, the template's sections are populated with context from the agent's commit: - Description/Summary sections: filled with the commit body - Type of change sections: filled with the conventional commit type (fix, feat, etc.) - How to test sections: links to the originating issue - Related issues sections: references the issue number - Screenshots sections: marked N/A - Unrecognized sections: preserved as-is from the template - Checkbox items in filled sections: preserved for reviewers HTML comments (author instructions) are stripped. Templates without markdown headers get the description prepended. When no template exists, the existing freeform format is used as a fallback. Added 20 test cases covering section filling, HTML comment stripping, checkbox preservation, unrecognized section passthrough, headerless templates, and full body assembly with and without templates. Note: pre-commit could not run in the sandbox due to Go module cache permission errors (sandbox infrastructure issue, not related to these shell script changes). The post-script runs authoritative pre-commit on the CI runner. Closes #1575
Site previewPreview: https://af883d15-site.fullsend-ai.workers.dev Commit: |
|
🤖 Finished Review · ✅ Success · Started 1:43 PM UTC · Completed 1:55 PM UTC |
ReviewFindingsLow
Info
|
| @@ -376,9 +463,27 @@ else | |||
| DESCRIPTION="${COMMIT_BODY}" | |||
| fi | |||
|
|
|||
There was a problem hiding this comment.
[low] edge-case
COMMIT_TYPE extraction with grep -oE '^[a-z]+' matches any leading lowercase word, not just valid conventional commit types. A non-conventional subject would produce misleading output in the Type of change template section.
Suggested fix: Validate COMMIT_TYPE against a known list (fix|feat|chore|docs|refactor|test|ci|build|perf|style|revert) and fall back to 'change' if it doesn't match.
| # Test helper — reimplements the PR template population logic from | ||
| # post-code.sh so we can test it without a git repo or network access. | ||
| # --------------------------------------------------------------------------- | ||
| populate_pr_template() { |
There was a problem hiding this comment.
[low] test-adequacy
The test helper populate_pr_template is a full copy-paste of the production function. If either copy is updated independently, tests will pass against stale logic with no mechanism to detect drift.
| printf '%s\n\n%s\n' "${description}" "${clean}" | ||
| return | ||
| fi | ||
|
|
There was a problem hiding this comment.
[low] edge-case
Header detection regex ^#{1,3}[[:space:]] only matches h1-h3. H4+ sub-sections under a recognized section will be silently dropped when skip_body is true.
| # Test helper — reimplements the PR template population logic from | ||
| # post-code.sh so we can test it without a git repo or network access. | ||
| # --------------------------------------------------------------------------- | ||
| populate_pr_template() { |
There was a problem hiding this comment.
[low] test-adequacy
No test covers the COMMIT_TYPE extraction logic (grep -oE '^[a-z]+'). The build_pr_body_with_template test helper accepts commit_type as a parameter, bypassing the extraction.
|
/fs-fix rebase |
|
🤖 Finished Fix · ❌ Failure · Started 8:18 AM UTC · Completed 8:26 AM UTC |
When creating PRs, post-code.sh now checks for .github/PULL_REQUEST_TEMPLATE.md (and other GitHub-supported locations) in the target repo. If found, the template's sections are populated with context from the agent's commit:
type (fix, feat, etc.)
HTML comments (author instructions) are stripped. Templates without markdown headers get the description prepended. When no template exists, the existing freeform format is used as a fallback.
Added 20 test cases covering section filling, HTML comment stripping, checkbox preservation, unrecognized section passthrough, headerless templates, and full body assembly with and without templates.
Note: pre-commit could not run in the sandbox due to Go module cache permission errors (sandbox infrastructure issue, not related to these shell script changes). The post-script runs authoritative pre-commit on the CI runner.
Closes #1575
Post-script verification
agent/1575-pr-template-support)1281fa9973718b519e2a2404f247cf26baf6521f..HEAD)