Skip to content

Commit cd3d65e

Browse files
committed
Add CI artifact link to PR summaries
1 parent cd2dc48 commit cd3d65e

4 files changed

Lines changed: 50 additions & 2 deletions

File tree

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
All notable changes to AgentScope are documented in this file.
44

5+
## Unreleased
6+
7+
### Added
8+
9+
- **CI artifact link in PR summaries.** summarize now links to the GitHub Actions run when GITHUB_RUN_ID is set.
10+
511
## [1.0.0] - 2026-06-07
612

713
### Added

bin/agentscope.js

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -876,9 +876,10 @@ function renderRunSummary(run, headingLevel = 2, opts = {}) {
876876
function generateTraceSummary(trace, opts = {}) {
877877
const warnings = collectTraceQualityWarnings(trace)
878878
const warningLines = renderQualityWarnings(warnings)
879+
const artifactLines = renderArtifactLink()
879880

880881
if (trace.runs.length === 1) {
881-
return [renderRunSummary(trace.runs[0], 2, opts), ...warningLines].join('\n').trimEnd()
882+
return [renderRunSummary(trace.runs[0], 2, opts), ...warningLines, ...artifactLines].join('\n').trimEnd()
882883
}
883884

884885
const lines = [
@@ -900,9 +901,25 @@ function generateTraceSummary(trace, opts = {}) {
900901
}
901902

902903
lines.push(...warningLines)
904+
lines.push(...artifactLines)
903905
return lines.join('\n').trimEnd()
904906
}
905907

908+
function renderArtifactLink() {
909+
const serverUrl = process.env.GITHUB_SERVER_URL || 'https://github.com'
910+
const repo = process.env.GITHUB_REPOSITORY
911+
const runId = process.env.GITHUB_RUN_ID
912+
913+
if (!repo || !runId) return []
914+
915+
const url = `${serverUrl}/${repo}/actions/runs/${runId}`
916+
return [
917+
'',
918+
`Trace artifact: [GitHub Actions run](${url})`,
919+
'',
920+
]
921+
}
922+
906923
function renderQualityWarnings(warnings) {
907924
if (warnings.length === 0) return []
908925

docs/roadmap.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ The current PR comment summary is useful, but still basic.
6363
Expected work:
6464

6565
- [x] Add a compact quality checklist.
66-
- Link uploaded trace artifacts when available.
66+
- [x] Link uploaded trace artifacts when available.
6767
- [x] Show omitted action counts more clearly.
6868
- [x] Keep comments short enough for repeated PR review.
6969

test/agentscope-cli.test.mjs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,31 @@ test('summarize --dry-run renders trace quality warnings', () => {
332332
})
333333
})
334334

335+
test('summarize links to CI run when GITHUB_RUN_ID is set', () => {
336+
const output = runCli(['summarize', '--input', authTrace, '--dry-run'], {
337+
env: {
338+
GITHUB_REPOSITORY: 'ding-swj/AgentScope',
339+
GITHUB_RUN_ID: '123456',
340+
},
341+
})
342+
343+
assert.match(output, /github\.com\/ding-swj\/AgentScope\/actions\/runs\/123456/)
344+
assert.match(output, /Trace artifact/)
345+
})
346+
347+
test('summarize does not link CI run when GITHUB_RUN_ID is absent', () => {
348+
const output = runCli(['summarize', '--input', authTrace, '--dry-run'], {
349+
env: {
350+
GITHUB_REPOSITORY: '',
351+
GITHUB_RUN_ID: '',
352+
GITHUB_SERVER_URL: '',
353+
},
354+
})
355+
356+
assert.doesNotMatch(output, /actions\/runs/)
357+
assert.doesNotMatch(output, /Trace artifact/)
358+
})
359+
335360
test('summarize --compact reduces verification output size', () => {
336361
withTempDir((dir) => {
337362
const fixture = writeTraceFixture(dir, 'compact-verification.trace.json', [

0 commit comments

Comments
 (0)