Skip to content

Commit a7b8e18

Browse files
committed
CI: post Squid container logs as PR comment on failure
Use actions/github-script to post docker logs output as a PR comment when E2E tests fail, enabling remote diagnosis of Squid crashes. https://claude.ai/code/session_01Tfy3kPd51qRgxpCFXjb2g9
1 parent 8862c83 commit a7b8e18

1 file changed

Lines changed: 32 additions & 0 deletions

File tree

.github/workflows/squid-build-test.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,22 @@ jobs:
249249
grep -q "test" /tmp/proxy-response.txt || { echo "FAIL: unexpected response body"; exit 1; }
250250
echo "--- HTTP via SOCKS5 OK ---"
251251
252+
- name: Post Squid logs to PR on failure
253+
if: failure()
254+
uses: actions/github-script@v7
255+
with:
256+
script: |
257+
const { execSync } = require('child_process');
258+
let logs = '';
259+
try { logs = execSync('docker logs squid-test 2>&1', {encoding: 'utf8', maxBuffer: 50*1024}); } catch(e) { logs = e.stdout || e.message; }
260+
const body = `### E2E Test Squid Logs\n\`\`\`\n${logs.slice(-3000)}\n\`\`\``;
261+
await github.rest.issues.createComment({
262+
owner: context.repo.owner,
263+
repo: context.repo.repo,
264+
issue_number: 30,
265+
body: body
266+
});
267+
252268
- name: Collect logs
253269
if: always()
254270
run: |
@@ -390,6 +406,22 @@ jobs:
390406
grep -q "test" /tmp/proxy-response.txt || { echo "FAIL: unexpected body"; exit 1; }
391407
echo "--- HTTP via SOCKS5 auth OK ---"
392408
409+
- name: Post Squid logs to PR on failure
410+
if: failure()
411+
uses: actions/github-script@v7
412+
with:
413+
script: |
414+
const { execSync } = require('child_process');
415+
let logs = '';
416+
try { logs = execSync('docker logs squid-auth 2>&1', {encoding: 'utf8', maxBuffer: 50*1024}); } catch(e) { logs = e.stdout || e.message; }
417+
const body = `### Auth Test Squid Logs\n\`\`\`\n${logs.slice(-3000)}\n\`\`\``;
418+
await github.rest.issues.createComment({
419+
owner: context.repo.owner,
420+
repo: context.repo.repo,
421+
issue_number: 30,
422+
body: body
423+
});
424+
393425
- name: Collect logs
394426
if: always()
395427
run: |

0 commit comments

Comments
 (0)