Skip to content

[docs] docs: debloat templating.md (-72 lines, -21.6%)#17003

Merged
pelikhan merged 1 commit intomainfrom
docs/unbloat-templating-0a1b47b490101f85
Feb 20, 2026
Merged

[docs] docs: debloat templating.md (-72 lines, -21.6%)#17003
pelikhan merged 1 commit intomainfrom
docs/unbloat-templating-0a1b47b490101f85

Conversation

@github-actions
Copy link
Contributor

Reduces docs/src/content/docs/reference/templating.md from 334 lines to 262 lines (-72 lines, -21.6%) while preserving all technical content.

What was improved

File: docs/src/content/docs/reference/templating.md

Bloat removed

Section Before After Change
Common Use Cases 4 near-identical \{\\{\#runtime-import}} examples 2 combined examples showing file + URL with line range -26 lines
Error Handling 5 separate fenced code blocks (one per error type) Compact 5-row table -25 lines
Caching 5 bullet-point list + paragraph 2-sentence prose -6 lines
Security Features – Content Sanitization Paragraph + nested "This prevents:" bullet list Single inline paragraph -7 lines
URL Imports Paragraph + two separate labeled examples Paragraph + single combined code block -8 lines

What was preserved

  • All technical details (path restrictions, caching duration, SHA256 keying, error messages, processing order)
  • All code examples (condensed, not removed)
  • All links to related documentation
  • Frontmatter and page structure

Blocked Domains (screenshot attempt)

Screenshots of the rendered Astro Starlight page could not be captured. The Playwright browser sandbox blocks connections to 127.0.0.1 and private network IPs (ERR_CONNECTION_REFUSED / ERR_BLOCKED_BY_CLIENT), preventing localhost preview navigation.

References: §22205316494

AI generated by Documentation Unbloat

  • expires on Feb 22, 2026, 12:07 AM UTC

Condensed Common Use Cases from 4 near-identical examples to 2 combined
examples, replaced verbose Error Handling code blocks with a compact table,
collapsed the Caching bullet list into prose, and tightened the Security
Features "Content Sanitization" description. Reduces file from 334 to 262
lines (-72 lines, -21.6%) while preserving all technical content.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@pelikhan pelikhan marked this pull request as ready for review February 20, 2026 00:36
Copilot AI review requested due to automatic review settings February 20, 2026 00:36
@pelikhan pelikhan merged commit eb08477 into main Feb 20, 2026
3 checks passed
@pelikhan pelikhan deleted the docs/unbloat-templating-0a1b47b490101f85 branch February 20, 2026 00:36
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Reduces verbosity in the templating reference documentation by consolidating repetitive examples and compressing several sections while aiming to preserve the same technical guidance.

Changes:

  • Consolidated URL import examples and simplified related prose.
  • Compressed security, caching, and processing-order sections into shorter descriptions.
  • Replaced multiple error-handling code blocks with a compact table.
Comments suppressed due to low confidence (2)

docs/src/content/docs/reference/templating.md:253

  • The “Path traversal” row truncates the actual error and drops the (resolves to: ...) detail that’s included in the thrown message (actions/setup/js/runtime_import.cjs:775-777). For accuracy/troubleshooting, include the full message (or at least indicate that the resolved path is reported).
| Path traversal | `Security: Path ../src/main.go must be within .github folder` |

docs/src/content/docs/reference/templating.md:254

  • The “GitHub Actions macros” row doesn’t match the actual runtime-import error format. Unauthorized expressions throw a multi-line error like <source> contains unauthorized GitHub Actions expressions: followed by a bullet list and allowed categories (actions/setup/js/runtime_import.cjs:413-425). Please update this row to reflect the real message structure/content.
| GitHub Actions macros | `File template.md contains GitHub Actions macros (${{ ... }}) which are not allowed in runtime imports` |

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.


Follow this checklist:

{{#runtime-import https://company.com/security/api-checklist.md}}
Copy link

Copilot AI Feb 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This heading says the URL example includes a line range, but the URL import shown doesn’t specify one (it’s a plain .../api-checklist.md). Either update the heading or add a :start-end suffix to the URL so the example matches the described feature.

Suggested change
{{#runtime-import https://company.com/security/api-checklist.md}}
{{#runtime-import https://company.com/security/api-checklist.md:10-50}}

Copilot uses AI. Check for mistakes.
Current implementation (from .github/docs/engine.go):

Reference implementation (lines 100-150):
{{#runtime-import docs/engine.go:100-150}}
Copy link

Copilot AI Feb 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

{{#runtime-import docs/engine.go:100-150}} is ambiguous given the runtime-import path resolution rules. The runtime importer rewrites paths that don’t start with .github/ to live under .github/workflows/ (actions/setup/js/runtime_import.cjs:731-734), so this will resolve to .github/workflows/docs/engine.go, not .github/docs/engine.go. Adjust the example path/text to match the actual resolution you intend.

Suggested change
{{#runtime-import docs/engine.go:100-150}}
{{#runtime-import workflows/docs/engine.go:100-150}}

Copilot uses AI. Check for mistakes.
@@ -290,41 +246,13 @@ Suggested improvements needed.

### Error Handling

Copy link

Copilot AI Feb 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The “File not found” error message is shown without the outer wrapper that runtime-import processing adds. In the implementation, errors are rethrown as Failed to process runtime import for <path>: <inner error> (actions/setup/js/runtime_import.cjs:951-954). Consider showing the full user-facing message (or explicitly noting it’s the inner error only).

This issue also appears in the following locations of the same file:

  • line 253
  • line 254
Suggested change
These examples show the inner error messages only. At runtime, errors are wrapped as:
`Failed to process runtime import for <path>: <inner error>`.

Copilot uses AI. Check for mistakes.
- Template injection attacks
- Unintended variable expansion
- Security vulnerabilities from imported content
**Content Sanitization:** YAML front matter and HTML/XML comments are automatically stripped. GitHub Actions expressions (`${{ ... }}`) are **rejected with error** to prevent template injection and unintended variable expansion.
Copy link

Copilot AI Feb 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Content Sanitization text says GitHub Actions expressions (${{ ... }}) are "rejected with error", but runtime imports actually allow a safe subset of expressions and only reject unauthorized ones (see docs earlier under “Permitted expressions” and implementation in actions/setup/js/runtime_import.cjs:processExpressions). Please reword to reflect that only unauthorized/unsafe expressions are rejected.

Suggested change
**Content Sanitization:** YAML front matter and HTML/XML comments are automatically stripped. GitHub Actions expressions (`${{ ... }}`) are **rejected with error** to prevent template injection and unintended variable expansion.
**Content Sanitization:** YAML front matter and HTML/XML comments are automatically stripped. Only permitted GitHub Actions expressions (`${{ ... }}`) are evaluated; unauthorized expressions are **rejected with error** to prevent template injection and unintended variable expansion.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automation documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants