-
Notifications
You must be signed in to change notification settings - Fork 365
Suggest tools.github.mode: gh-proxy when api.github.com is firewall-blocked
#28293
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
55d16d2
e43828b
2eb2067
4e3a6c9
d791deb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -11,6 +11,8 @@ | |||||||||||||||||||||||||||
| const fs = require("fs"); | ||||||||||||||||||||||||||||
| const path = require("path"); | ||||||||||||||||||||||||||||
| const { sanitizeDomainName } = require("./sanitize_content_core.cjs"); | ||||||||||||||||||||||||||||
| const { renderTemplateFromFile } = require("./messages_core.cjs"); | ||||||||||||||||||||||||||||
| const { renderMarkdownTemplate } = require("./render_template.cjs"); | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| /** | ||||||||||||||||||||||||||||
| * Parses a single firewall log line | ||||||||||||||||||||||||||||
|
|
@@ -184,43 +186,50 @@ function getBlockedDomains(logsDir) { | |||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| /** | ||||||||||||||||||||||||||||
| * Generates HTML details/summary section for blocked domains wrapped in a GitHub warning alert | ||||||||||||||||||||||||||||
| * @param {string[]} blockedDomains - Array of blocked domain names | ||||||||||||||||||||||||||||
| * @param {string[]} blockedDomains - Array of blocked domain names (expected to be pre-sanitized via getBlockedDomains) | ||||||||||||||||||||||||||||
| * @param {string} [templatePath] - Optional path to template file (defaults to RUNNER_TEMP/gh-aw/prompts/firewall_blocked_domains.md) | ||||||||||||||||||||||||||||
| * @returns {string} GitHub warning alert with details section, or empty string if no blocked domains | ||||||||||||||||||||||||||||
| */ | ||||||||||||||||||||||||||||
| function generateBlockedDomainsSection(blockedDomains) { | ||||||||||||||||||||||||||||
| function generateBlockedDomainsSection(blockedDomains, templatePath) { | ||||||||||||||||||||||||||||
| if (!blockedDomains || blockedDomains.length === 0) { | ||||||||||||||||||||||||||||
| return ""; | ||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| const domainCount = blockedDomains.length; | ||||||||||||||||||||||||||||
| const domainWord = domainCount === 1 ? "domain" : "domains"; | ||||||||||||||||||||||||||||
| const verb = domainCount === 1 ? "was" : "were"; | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| let section = "\n\n> [!WARNING]\n"; | ||||||||||||||||||||||||||||
| section += `> **⚠️ Firewall blocked ${domainCount} ${domainWord}**\n`; | ||||||||||||||||||||||||||||
| section += `>\n`; | ||||||||||||||||||||||||||||
| section += `> The following ${domainWord} ${domainCount === 1 ? "was" : "were"} blocked by the firewall during workflow execution:\n`; | ||||||||||||||||||||||||||||
| section += `>\n`; | ||||||||||||||||||||||||||||
| // Build domain bullet list lines | ||||||||||||||||||||||||||||
| const domainList = blockedDomains.map(domain => `> - \`${domain}\`\n`).join(""); | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| // List domains as bullet points (within the alert) | ||||||||||||||||||||||||||||
| for (const domain of blockedDomains) { | ||||||||||||||||||||||||||||
| section += `> - \`${domain}\`\n`; | ||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||
| // Build YAML network.allowed list lines | ||||||||||||||||||||||||||||
| const yamlNetworkList = blockedDomains.map(domain => `> - "${domain}"\n`).join(""); | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| const hasGitHubApiBlocked = blockedDomains.includes("api.github.com"); | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| section += `>\n`; | ||||||||||||||||||||||||||||
| section += `> To allow these domains, add them to the \`network.allowed\` list in your workflow frontmatter:\n`; | ||||||||||||||||||||||||||||
| section += `>\n`; | ||||||||||||||||||||||||||||
| section += `> \`\`\`yaml\n`; | ||||||||||||||||||||||||||||
| section += `> network:\n`; | ||||||||||||||||||||||||||||
| section += `> allowed:\n`; | ||||||||||||||||||||||||||||
| section += `> - defaults\n`; | ||||||||||||||||||||||||||||
| for (const domain of blockedDomains) { | ||||||||||||||||||||||||||||
| section += `> - "${domain}"\n`; | ||||||||||||||||||||||||||||
| // Resolve template path: explicit > RUNNER_TEMP (production) > source tree (local dev/test) | ||||||||||||||||||||||||||||
| let resolvedTemplatePath = templatePath; | ||||||||||||||||||||||||||||
| if (!resolvedTemplatePath) { | ||||||||||||||||||||||||||||
| resolvedTemplatePath = process.env.RUNNER_TEMP ? `${process.env.RUNNER_TEMP}/gh-aw/prompts/firewall_blocked_domains.md` : path.join(__dirname, "../md/firewall_blocked_domains.md"); | ||||||||||||||||||||||||||||
|
Comment on lines
+210
to
+213
|
||||||||||||||||||||||||||||
| // Resolve template path: explicit > RUNNER_TEMP (production) > source tree (local dev/test) | |
| let resolvedTemplatePath = templatePath; | |
| if (!resolvedTemplatePath) { | |
| resolvedTemplatePath = process.env.RUNNER_TEMP ? `${process.env.RUNNER_TEMP}/gh-aw/prompts/firewall_blocked_domains.md` : path.join(__dirname, "../md/firewall_blocked_domains.md"); | |
| // Resolve template path: explicit > GH_AW_PROMPTS_DIR override > RUNNER_TEMP (production) > source tree (local dev/test) | |
| let resolvedTemplatePath = templatePath; | |
| if (!resolvedTemplatePath) { | |
| const promptsDir = | |
| process.env.GH_AW_PROMPTS_DIR || | |
| (process.env.RUNNER_TEMP && `${process.env.RUNNER_TEMP}/gh-aw/prompts`); | |
| resolvedTemplatePath = promptsDir | |
| ? path.join(promptsDir, "firewall_blocked_domains.md") | |
| : path.join(__dirname, "../md/firewall_blocked_domains.md"); |
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,27 @@ | ||||||||
| > [!WARNING] | ||||||||
| > **⚠️ Firewall blocked {domain_count} {domain_word}** | ||||||||
| > | ||||||||
| > The following {domain_word} {verb} blocked by the firewall during workflow execution: | ||||||||
| > | ||||||||
| {domain_list}> | ||||||||
|
||||||||
| {domain_list}> | |
| {domain_list} |
Copilot
AI
Apr 24, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The YAML list placeholder and the closing code fence are currently on the same template line ({yaml_network_list}> ````). This is fragile and can produce malformed Markdown depending on whether the placeholder expansion ends with a newline. Put {yaml_network_list}on its own line and keep the closing> ``` on the next line (and remove any stray>` after the placeholder) so the fenced block is always well-formed.
| {yaml_network_list}> ``` | |
| {yaml_network_list} | |
| > ``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The JSDoc still says this function generates an “HTML details/summary section”, but the implementation now renders a Markdown warning alert from a template. Update the description to match the actual output to avoid confusing future maintainers.
See below for a potential fix: