-
Notifications
You must be signed in to change notification settings - Fork 486
Add generated footer to status comment updates #51165
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
339bb7e
bdb4d42
953d215
4dd5675
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 |
|---|---|---|
|
|
@@ -235,7 +235,7 @@ | |
| (process.env.GH_AW_WORKFLOW_NAME = "test-workflow"), | ||
| (process.env.GH_AW_AGENT_CONCLUSION = "failure"), | ||
| (process.env.GH_AW_DETECTION_CONCLUSION = "warning"), | ||
| await eval(`(async () => { ${notifyCommentScript}; await main(); })()`), | ||
|
Check failure on line 238 in actions/setup/js/notify_comment_error.test.cjs
|
||
| expect(mockGithub.request).toHaveBeenCalledWith("PATCH /repos/{owner}/{repo}/issues/comments/{comment_id}", expect.objectContaining({ body: expect.stringContaining("failed. Please review the logs") }))); | ||
| }), | ||
| it("should show cancelled message with detection warning when agent is cancelled", async () => { | ||
|
|
@@ -244,7 +244,7 @@ | |
| (process.env.GH_AW_WORKFLOW_NAME = "test-workflow"), | ||
| (process.env.GH_AW_AGENT_CONCLUSION = "cancelled"), | ||
| (process.env.GH_AW_DETECTION_CONCLUSION = "warning"), | ||
| await eval(`(async () => { ${notifyCommentScript}; await main(); })()`), | ||
|
Check failure on line 247 in actions/setup/js/notify_comment_error.test.cjs
|
||
| expect(mockGithub.request).toHaveBeenCalledWith("PATCH /repos/{owner}/{repo}/issues/comments/{comment_id}", expect.objectContaining({ body: expect.stringContaining("was cancelled. Please review the logs") }))); | ||
| }), | ||
| it("should show timed out message with detection warning when agent times out", async () => { | ||
|
|
@@ -253,7 +253,7 @@ | |
| (process.env.GH_AW_WORKFLOW_NAME = "test-workflow"), | ||
| (process.env.GH_AW_AGENT_CONCLUSION = "timed_out"), | ||
| (process.env.GH_AW_DETECTION_CONCLUSION = "warning"), | ||
| await eval(`(async () => { ${notifyCommentScript}; await main(); })()`), | ||
|
Check failure on line 256 in actions/setup/js/notify_comment_error.test.cjs
|
||
| expect(mockGithub.request).toHaveBeenCalledWith("PATCH /repos/{owner}/{repo}/issues/comments/{comment_id}", expect.objectContaining({ body: expect.stringContaining("timed out. Please review the logs") }))); | ||
| }), | ||
| it("should show assignment failure message with detection warning when agent succeeds but assign-to-agent fails", async () => { | ||
|
|
@@ -263,7 +263,7 @@ | |
| (process.env.GH_AW_AGENT_CONCLUSION = "success"), | ||
| (process.env.GH_AW_ASSIGNMENT_ERROR_COUNT = "2"), | ||
| (process.env.GH_AW_DETECTION_CONCLUSION = "warning"), | ||
| await eval(`(async () => { ${notifyCommentScript}; await main(); })()`), | ||
|
Check failure on line 266 in actions/setup/js/notify_comment_error.test.cjs
|
||
| expect(mockGithub.request).toHaveBeenCalledWith("PATCH /repos/{owner}/{repo}/issues/comments/{comment_id}", expect.objectContaining({ body: expect.stringContaining("failed to assign the coding agent") }))); | ||
| })); | ||
| }), | ||
|
|
@@ -331,7 +331,7 @@ | |
| (process.env.GH_AW_SAFE_OUTPUT_JOBS = JSON.stringify({ create_issue: "issue_url" })), | ||
| await eval(`(async () => { ${notifyCommentScript}; await main(); })()`)); | ||
| const callArgs = mockGithub.request.mock.calls[0][1]; | ||
| expect(callArgs.body).toMatch(/completed successfully!$/); | ||
| expect(callArgs.body).toContain("completed successfully!"); | ||
| }), | ||
| it("should handle empty safe output jobs gracefully", async () => { | ||
| ((process.env.GH_AW_COMMENT_ID = "123456"), | ||
|
|
@@ -340,7 +340,7 @@ | |
| (process.env.GH_AW_AGENT_CONCLUSION = "success"), | ||
| await eval(`(async () => { ${notifyCommentScript}; await main(); })()`)); | ||
| const callArgs = mockGithub.request.mock.calls[0][1]; | ||
| expect(callArgs.body).toMatch(/completed successfully!$/); | ||
| expect(callArgs.body).toContain("completed successfully!"); | ||
| })); | ||
| }), | ||
| describe("when safe_outputs job fails", () => { | ||
|
|
@@ -361,7 +361,7 @@ | |
| (process.env.GH_AW_AGENT_CONCLUSION = "success"), | ||
| (process.env.GH_AW_SAFE_OUTPUTS_RESULT = "failure"), | ||
| (process.env.GH_AW_DETECTION_CONCLUSION = "warning"), | ||
| await eval(`(async () => { ${notifyCommentScript}; await main(); })()`), | ||
|
Check failure on line 364 in actions/setup/js/notify_comment_error.test.cjs
|
||
| expect(mockGithub.request).toHaveBeenCalledWith("PATCH /repos/{owner}/{repo}/issues/comments/{comment_id}", expect.objectContaining({ body: expect.stringContaining("failed to deliver outputs. Please review the logs") }))); | ||
| }), | ||
| it("should show success message when agent succeeds and safe_outputs succeeds", async () => { | ||
|
|
@@ -373,5 +373,27 @@ | |
| await eval(`(async () => { ${notifyCommentScript}; await main(); })()`), | ||
| expect(mockGithub.request).toHaveBeenCalledWith("PATCH /repos/{owner}/{repo}/issues/comments/{comment_id}", expect.objectContaining({ body: expect.stringContaining("completed successfully!") }))); | ||
| })); | ||
| }), | ||
| describe("footer in status comment", () => { | ||
| (it("should include the generated footer in the updated comment body", async () => { | ||
| ((process.env.GH_AW_COMMENT_ID = "123456"), | ||
| (process.env.GH_AW_RUN_URL = "https://github.com/owner/repo/actions/runs/123"), | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [/tdd] The two new footer tests share identical env setup and differ only in @copilot please address this. |
||
| (process.env.GH_AW_WORKFLOW_NAME = "test-workflow"), | ||
| (process.env.GH_AW_AGENT_CONCLUSION = "success"), | ||
| await eval(`(async () => { ${notifyCommentScript}; await main(); })()`)); | ||
| const callArgs = mockGithub.request.mock.calls[0][1]; | ||
| expect(callArgs.body).toMatch(/Generated by \[test-workflow\]/); | ||
| expect(callArgs.body).toMatch(/gh-aw-agentic-workflow/); | ||
| }), | ||
| it("should include the generated footer even when agent fails", async () => { | ||
| ((process.env.GH_AW_COMMENT_ID = "123456"), | ||
| (process.env.GH_AW_RUN_URL = "https://github.com/owner/repo/actions/runs/123"), | ||
| (process.env.GH_AW_WORKFLOW_NAME = "test-workflow"), | ||
| (process.env.GH_AW_AGENT_CONCLUSION = "failure"), | ||
| await eval(`(async () => { ${notifyCommentScript}; await main(); })()`)); | ||
| const callArgs = mockGithub.request.mock.calls[0][1]; | ||
| expect(callArgs.body).toMatch(/Generated by \[test-workflow\]/); | ||
| expect(callArgs.body).toMatch(/gh-aw-agentic-workflow/); | ||
| })); | ||
| })); | ||
| })); | ||
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.
[/codebase-design]
GH_AW_WORKFLOW_SOURCEandGH_AW_WORKFLOW_SOURCE_URLare re-read fromprocess.envhere, butworkflowNameandrunUrlwere already read at lines 114–115 from the same source. Consider reading all workflow env vars together near the top ofmain()for consistency and to make the full set of dependencies obvious at a glance.@copilot please address this.