[WIP] Update generated footer to include gh-aw-workflow-call-id#19525
[WIP] Update generated footer to include gh-aw-workflow-call-id#19525
Conversation
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
|
✅ All tools validated successfully! Agent Container Smoke Test confirms agent container is ready. |
|
🌑 The shadows whisper... Smoke Codex failed. The oracle requires further meditation... |
|
📰 BREAKING: Smoke Copilot is now investigating this pull request. Sources say the story is developing... |
|
🎬 THE END — Smoke Claude MISSION: ACCOMPLISHED! The hero saves the day! ✨ |
Agent Container Tool Check
Result: 12/12 tools available ✅ Overall Status: PASS
|
|
Commit pushed:
|
Smoke Test: Copilot - 22657504683
Overall: PR by
|
There was a problem hiding this comment.
Reviewed PR #19525: [WIP] Update generated footer to include gh-aw-workflow-call-id. The changes correctly add the gh-aw-workflow-call-id marker to comment bodies when GH_AW_CALLER_WORKFLOW_ID is set, with good test coverage for both cases. Minor suggestion: add edge case test for empty string env var.
📰 BREAKING: Report filed by Smoke Copilot
| it("should not include gh-aw-workflow-call-id marker when GH_AW_CALLER_WORKFLOW_ID is not set", async () => { | ||
| const addCommentScript = fs.readFileSync(path.join(__dirname, "add_comment.cjs"), "utf8"); | ||
|
|
||
| process.env.GH_AW_WORKFLOW_NAME = "Test Workflow"; |
There was a problem hiding this comment.
Good test coverage for both the positive case (marker present when env var set) and negative case (marker absent when env var not set). Consider also testing the edge case where GH_AW_CALLER_WORKFLOW_ID is set to an empty string.
| // Add workflow-call-id marker when available to allow close-older-comments to | ||
| // distinguish callers that share the same reusable workflow (and GH_AW_WORKFLOW_ID) | ||
| if (callerWorkflowId) { | ||
| processedBody += "\n" + generateWorkflowCallIdMarker(callerWorkflowId); |
There was a problem hiding this comment.
The workflow-call-id marker is correctly placed after the XML marker. This enables close-older-comments to distinguish between different callers sharing the same reusable workflow — a clean solution to the caller disambiguation problem.
|
📰 VERDICT: Smoke Copilot has concluded. All systems operational. This is a developing story. 🎤 |
Smoke Test Results — Run §22657504616Core Tests (#1–10): ✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅
Overall: PARTIAL (15 passed, 2 skipped, 0 failed)
|
There was a problem hiding this comment.
💥 Automated smoke test review - all systems nominal!
💥 [THE END] — Illustrated by Smoke Claude
There was a problem hiding this comment.
Pull request overview
Updates the add-comment safe output footer/metadata so comments can be disambiguated by calling workflow identity (useful when multiple workflows share the same reusable workflow).
Changes:
- Append a
gh-aw-workflow-call-idXML marker to generated comment bodies whenGH_AW_CALLER_WORKFLOW_IDis set. - Add tests covering presence/absence of the marker based on
GH_AW_CALLER_WORKFLOW_ID. - Add a changeset documenting the patch behavior change.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| actions/setup/js/add_comment.cjs | Appends the workflow-call-id marker after footer generation when caller workflow ID is available. |
| actions/setup/js/add_comment.test.cjs | Adds assertions that the marker is included/excluded depending on GH_AW_CALLER_WORKFLOW_ID. |
| .changeset/patch-add-workflow-call-id-marker.md | Declares a patch release describing the new marker behavior. |
Comments suppressed due to low confidence (1)
actions/setup/js/add_comment.test.cjs:1347
- Same teardown concern here: deleting env vars at the end of the test can leak state if the test fails before reaching these lines. Using
afterEach/finallyforGH_AW_WORKFLOW_NAME(and any related env) would make failures easier to debug.
delete process.env.GH_AW_WORKFLOW_NAME;
});
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
| process.env.GH_AW_WORKFLOW_NAME = "Test Workflow"; | ||
| process.env.GH_AW_CALLER_WORKFLOW_ID = "owner/repo/TestWorkflow"; | ||
|
|
||
| let capturedBody = null; | ||
| mockGithub.rest.issues.createComment = async params => { | ||
| capturedBody = params.body; | ||
| return { | ||
| data: { | ||
| id: 12345, | ||
| html_url: "https://github.com/owner/repo/issues/42#issuecomment-12345", | ||
| }, | ||
| }; | ||
| }; | ||
|
|
||
| const handler = await eval(`(async () => { ${addCommentScript}; return await main({}); })()`); | ||
|
|
||
| const message = { | ||
| type: "add_comment", | ||
| body: "Test comment body", | ||
| }; | ||
|
|
||
| const result = await handler(message, {}); | ||
|
|
||
| expect(result.success).toBe(true); | ||
| expect(capturedBody).toBeDefined(); | ||
| expect(capturedBody).toContain("<!-- gh-aw-workflow-call-id: owner/repo/TestWorkflow -->"); | ||
|
|
||
| delete process.env.GH_AW_WORKFLOW_NAME; | ||
| delete process.env.GH_AW_CALLER_WORKFLOW_ID; | ||
| }); | ||
|
|
||
| it("should not include gh-aw-workflow-call-id marker when GH_AW_CALLER_WORKFLOW_ID is not set", async () => { | ||
| const addCommentScript = fs.readFileSync(path.join(__dirname, "add_comment.cjs"), "utf8"); | ||
|
|
||
| process.env.GH_AW_WORKFLOW_NAME = "Test Workflow"; | ||
| delete process.env.GH_AW_CALLER_WORKFLOW_ID; | ||
|
|
||
| let capturedBody = null; | ||
| mockGithub.rest.issues.createComment = async params => { | ||
| capturedBody = params.body; | ||
| return { | ||
| data: { | ||
| id: 12345, | ||
| html_url: "https://github.com/owner/repo/issues/42#issuecomment-12345", | ||
| }, | ||
| }; | ||
| }; | ||
|
|
||
| const handler = await eval(`(async () => { ${addCommentScript}; return await main({}); })()`); | ||
|
|
||
| const message = { | ||
| type: "add_comment", | ||
| body: "Test comment body", | ||
| }; | ||
|
|
||
| const result = await handler(message, {}); | ||
|
|
||
| expect(result.success).toBe(true); | ||
| expect(capturedBody).toBeDefined(); | ||
| expect(capturedBody).not.toContain("gh-aw-workflow-call-id"); | ||
|
|
||
| delete process.env.GH_AW_WORKFLOW_NAME; |
There was a problem hiding this comment.
These env var cleanups only run if the test reaches the end; if an assertion throws, GH_AW_WORKFLOW_NAME / GH_AW_CALLER_WORKFLOW_ID can leak into subsequent tests and cause cascading failures. Consider using try/finally around the env setup or moving env setup/teardown into beforeEach/afterEach for this describe block.
This issue also appears on line 1346 of the same file.
| process.env.GH_AW_WORKFLOW_NAME = "Test Workflow"; | |
| process.env.GH_AW_CALLER_WORKFLOW_ID = "owner/repo/TestWorkflow"; | |
| let capturedBody = null; | |
| mockGithub.rest.issues.createComment = async params => { | |
| capturedBody = params.body; | |
| return { | |
| data: { | |
| id: 12345, | |
| html_url: "https://github.com/owner/repo/issues/42#issuecomment-12345", | |
| }, | |
| }; | |
| }; | |
| const handler = await eval(`(async () => { ${addCommentScript}; return await main({}); })()`); | |
| const message = { | |
| type: "add_comment", | |
| body: "Test comment body", | |
| }; | |
| const result = await handler(message, {}); | |
| expect(result.success).toBe(true); | |
| expect(capturedBody).toBeDefined(); | |
| expect(capturedBody).toContain("<!-- gh-aw-workflow-call-id: owner/repo/TestWorkflow -->"); | |
| delete process.env.GH_AW_WORKFLOW_NAME; | |
| delete process.env.GH_AW_CALLER_WORKFLOW_ID; | |
| }); | |
| it("should not include gh-aw-workflow-call-id marker when GH_AW_CALLER_WORKFLOW_ID is not set", async () => { | |
| const addCommentScript = fs.readFileSync(path.join(__dirname, "add_comment.cjs"), "utf8"); | |
| process.env.GH_AW_WORKFLOW_NAME = "Test Workflow"; | |
| delete process.env.GH_AW_CALLER_WORKFLOW_ID; | |
| let capturedBody = null; | |
| mockGithub.rest.issues.createComment = async params => { | |
| capturedBody = params.body; | |
| return { | |
| data: { | |
| id: 12345, | |
| html_url: "https://github.com/owner/repo/issues/42#issuecomment-12345", | |
| }, | |
| }; | |
| }; | |
| const handler = await eval(`(async () => { ${addCommentScript}; return await main({}); })()`); | |
| const message = { | |
| type: "add_comment", | |
| body: "Test comment body", | |
| }; | |
| const result = await handler(message, {}); | |
| expect(result.success).toBe(true); | |
| expect(capturedBody).toBeDefined(); | |
| expect(capturedBody).not.toContain("gh-aw-workflow-call-id"); | |
| delete process.env.GH_AW_WORKFLOW_NAME; | |
| const previousWorkflowName = process.env.GH_AW_WORKFLOW_NAME; | |
| const previousCallerWorkflowId = process.env.GH_AW_CALLER_WORKFLOW_ID; | |
| try { | |
| process.env.GH_AW_WORKFLOW_NAME = "Test Workflow"; | |
| process.env.GH_AW_CALLER_WORKFLOW_ID = "owner/repo/TestWorkflow"; | |
| let capturedBody = null; | |
| mockGithub.rest.issues.createComment = async params => { | |
| capturedBody = params.body; | |
| return { | |
| data: { | |
| id: 12345, | |
| html_url: "https://github.com/owner/repo/issues/42#issuecomment-12345", | |
| }, | |
| }; | |
| }; | |
| const handler = await eval(`(async () => { ${addCommentScript}; return await main({}); })()`); | |
| const message = { | |
| type: "add_comment", | |
| body: "Test comment body", | |
| }; | |
| const result = await handler(message, {}); | |
| expect(result.success).toBe(true); | |
| expect(capturedBody).toBeDefined(); | |
| expect(capturedBody).toContain("<!-- gh-aw-workflow-call-id: owner/repo/TestWorkflow -->"); | |
| } finally { | |
| if (previousWorkflowName === undefined) { | |
| delete process.env.GH_AW_WORKFLOW_NAME; | |
| } else { | |
| process.env.GH_AW_WORKFLOW_NAME = previousWorkflowName; | |
| } | |
| if (previousCallerWorkflowId === undefined) { | |
| delete process.env.GH_AW_CALLER_WORKFLOW_ID; | |
| } else { | |
| process.env.GH_AW_CALLER_WORKFLOW_ID = previousCallerWorkflowId; | |
| } | |
| } | |
| }); | |
| it("should not include gh-aw-workflow-call-id marker when GH_AW_CALLER_WORKFLOW_ID is not set", async () => { | |
| const addCommentScript = fs.readFileSync(path.join(__dirname, "add_comment.cjs"), "utf8"); | |
| const previousWorkflowName = process.env.GH_AW_WORKFLOW_NAME; | |
| const previousCallerWorkflowId = process.env.GH_AW_CALLER_WORKFLOW_ID; | |
| try { | |
| process.env.GH_AW_WORKFLOW_NAME = "Test Workflow"; | |
| delete process.env.GH_AW_CALLER_WORKFLOW_ID; | |
| let capturedBody = null; | |
| mockGithub.rest.issues.createComment = async params => { | |
| capturedBody = params.body; | |
| return { | |
| data: { | |
| id: 12345, | |
| html_url: "https://github.com/owner/repo/issues/42#issuecomment-12345", | |
| }, | |
| }; | |
| }; | |
| const handler = await eval(`(async () => { ${addCommentScript}; return await main({}); })()`); | |
| const message = { | |
| type: "add_comment", | |
| body: "Test comment body", | |
| }; | |
| const result = await handler(message, {}); | |
| expect(result.success).toBe(true); | |
| expect(capturedBody).toBeDefined(); | |
| expect(capturedBody).not.toContain("gh-aw-workflow-call-id"); | |
| } finally { | |
| if (previousWorkflowName === undefined) { | |
| delete process.env.GH_AW_WORKFLOW_NAME; | |
| } else { | |
| process.env.GH_AW_WORKFLOW_NAME = previousWorkflowName; | |
| } | |
| if (previousCallerWorkflowId === undefined) { | |
| delete process.env.GH_AW_CALLER_WORKFLOW_ID; | |
| } else { | |
| process.env.GH_AW_CALLER_WORKFLOW_ID = previousCallerWorkflowId; | |
| } | |
| } |
generateWorkflowCallIdMarkerimport toadd_comment.cjsgh-aw-workflow-call-idmarker to comment body after footer generation whencallerWorkflowIdis setadd_comment.test.cjsverifying the marker is included whenGH_AW_CALLER_WORKFLOW_IDis setadd_comment.test.cjsverifying the marker is absent whenGH_AW_CALLER_WORKFLOW_IDis not set🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.
✨ PR Review Safe Output Test - Run 22657504616