Skip to content

Commit d130cf2

Browse files
authored
fix: use workflow run URL instead of agentic workflow subpage in default footers (#31611)
1 parent 86db63f commit d130cf2

2 files changed

Lines changed: 20 additions & 17 deletions

File tree

actions/setup/js/messages.test.cjs

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ describe("messages.cjs", () => {
168168
runUrl: "https://github.com/test/repo/actions/runs/123",
169169
});
170170

171-
expect(result).toBe("> Generated by [Test Workflow](https://github.com/test/repo/actions/runs/123/agentic_workflow)");
171+
expect(result).toBe("> Generated by [Test Workflow](https://github.com/test/repo/actions/runs/123)");
172172
});
173173

174174
it("should append triggering number when provided", async () => {
@@ -180,7 +180,7 @@ describe("messages.cjs", () => {
180180
triggeringNumber: 42,
181181
});
182182

183-
expect(result).toBe("> Generated by [Test Workflow](https://github.com/test/repo/actions/runs/123/agentic_workflow) for issue #42");
183+
expect(result).toBe("> Generated by [Test Workflow](https://github.com/test/repo/actions/runs/123) for issue #42");
184184
});
185185

186186
it("should use custom footer template", async () => {
@@ -255,7 +255,7 @@ describe("messages.cjs", () => {
255255
historyUrl: "https://github.com/search?q=repo:test/repo+is:issue&type=issues",
256256
});
257257

258-
expect(result).toBe("> Generated by [Test Workflow](https://github.com/test/repo/actions/runs/123/agentic_workflow) · [◷](https://github.com/search?q=repo:test/repo+is:issue&type=issues)");
258+
expect(result).toBe("> Generated by [Test Workflow](https://github.com/test/repo/actions/runs/123) · [◷](https://github.com/search?q=repo:test/repo+is:issue&type=issues)");
259259
});
260260

261261
it("should include both triggering number and history link when both are provided", async () => {
@@ -268,7 +268,7 @@ describe("messages.cjs", () => {
268268
historyUrl: "https://github.com/search?q=repo:test/repo+is:issue&type=issues",
269269
});
270270

271-
expect(result).toBe("> Generated by [Test Workflow](https://github.com/test/repo/actions/runs/123/agentic_workflow) for issue #42 · [◷](https://github.com/search?q=repo:test/repo+is:issue&type=issues)");
271+
expect(result).toBe("> Generated by [Test Workflow](https://github.com/test/repo/actions/runs/123) for issue #42 · [◷](https://github.com/search?q=repo:test/repo+is:issue&type=issues)");
272272
});
273273

274274
it("should not append history link when historyUrl is not provided", async () => {
@@ -331,7 +331,11 @@ describe("messages.cjs", () => {
331331
expect(result).toBe("> Generated by [Test Workflow](https://github.com/test/repo/actions/runs/123/agentic_workflow)");
332332
});
333333

334-
it("should use explicit agenticWorkflowUrl from context instead of computing from runUrl", async () => {
334+
it("should use explicit agenticWorkflowUrl from context in custom templates", async () => {
335+
process.env.GH_AW_SAFE_OUTPUT_MESSAGES = JSON.stringify({
336+
footer: "> Generated by [{workflow_name}]({agentic_workflow_url})",
337+
});
338+
335339
const { getFooterMessage } = await import("./messages.cjs");
336340

337341
const result = getFooterMessage({
@@ -341,7 +345,6 @@ describe("messages.cjs", () => {
341345
});
342346

343347
expect(result).toBe("> Generated by [Test Workflow](https://github.com/test/repo/actions/runs/123/custom_path)");
344-
expect(result).not.toContain("/agentic_workflow");
345348
});
346349
});
347350

@@ -688,7 +691,7 @@ describe("messages.cjs", () => {
688691
runUrl: "https://github.com/test/repo/actions/runs/123",
689692
});
690693

691-
expect(result).toBe("> Generated from [Test Workflow](https://github.com/test/repo/actions/runs/123/agentic_workflow)");
694+
expect(result).toBe("> Generated from [Test Workflow](https://github.com/test/repo/actions/runs/123)");
692695
expect(result).not.toContain("●");
693696
});
694697

@@ -702,7 +705,7 @@ describe("messages.cjs", () => {
702705
runUrl: "https://github.com/test/repo/actions/runs/123",
703706
});
704707

705-
expect(result).toBe("> Generated from [Test Workflow](https://github.com/test/repo/actions/runs/123/agentic_workflow) · ● 12.5K");
708+
expect(result).toBe("> Generated from [Test Workflow](https://github.com/test/repo/actions/runs/123) · ● 12.5K");
706709
});
707710

708711
it("should include effective tokens before history link in default footer", async () => {
@@ -717,7 +720,7 @@ describe("messages.cjs", () => {
717720
historyUrl,
718721
});
719722

720-
expect(result).toBe(`> Generated from [Test Workflow](https://github.com/test/repo/actions/runs/123/agentic_workflow) · ● 5K · [◷](${historyUrl})`);
723+
expect(result).toBe(`> Generated from [Test Workflow](https://github.com/test/repo/actions/runs/123) · ● 5K · [◷](${historyUrl})`);
721724
});
722725

723726
it("should not include effective tokens in custom footer unless placeholder is used", async () => {
@@ -763,7 +766,7 @@ describe("messages.cjs", () => {
763766
runUrl: "https://github.com/test/repo/actions/runs/123",
764767
});
765768

766-
expect(result).toBe("> Generated from [Test Workflow](https://github.com/test/repo/actions/runs/123/agentic_workflow)");
769+
expect(result).toBe("> Generated from [Test Workflow](https://github.com/test/repo/actions/runs/123)");
767770
expect(result).not.toContain("●");
768771
});
769772

@@ -777,7 +780,7 @@ describe("messages.cjs", () => {
777780
runUrl: "https://github.com/test/repo/actions/runs/123",
778781
});
779782

780-
expect(result).toBe("> Generated from [Test Workflow](https://github.com/test/repo/actions/runs/123/agentic_workflow) · ● 12.5K");
783+
expect(result).toBe("> Generated from [Test Workflow](https://github.com/test/repo/actions/runs/123) · ● 12.5K");
781784
});
782785

783786
it("should include effective tokens before history link in default footer", async () => {
@@ -792,7 +795,7 @@ describe("messages.cjs", () => {
792795
historyUrl,
793796
});
794797

795-
expect(result).toBe(`> Generated from [Test Workflow](https://github.com/test/repo/actions/runs/123/agentic_workflow) · ● 5K · [◷](${historyUrl})`);
798+
expect(result).toBe(`> Generated from [Test Workflow](https://github.com/test/repo/actions/runs/123) · ● 5K · [◷](${historyUrl})`);
796799
});
797800

798801
it("should not include effective tokens in custom footer unless placeholder is used", async () => {

actions/setup/js/messages_footer.cjs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ function getFooterMessage(ctx) {
9090
}
9191

9292
// Default footer template - includes triggering reference if available
93-
let defaultFooter = "> Generated by [{workflow_name}]({agentic_workflow_url})";
93+
let defaultFooter = "> Generated by [{workflow_name}]({run_url})";
9494
if (ctx.triggeringNumber) {
9595
defaultFooter += " for issue #{triggering_number}";
9696
}
@@ -156,7 +156,7 @@ function getFooterWorkflowRecompileMessage(ctx) {
156156
const templateContext = toSnakeCase({ ...ctx, agenticWorkflowUrl, effectiveTokens, effectiveTokensFormatted, effectiveTokensSuffix });
157157

158158
// Default footer template
159-
const defaultFooter = "> Generated by [{workflow_name}]({agentic_workflow_url})";
159+
const defaultFooter = "> Generated by [{workflow_name}]({run_url})";
160160

161161
// Use custom workflow recompile footer if configured, otherwise use default footer
162162
let footer = messages?.footerWorkflowRecompile ? renderTemplate(messages.footerWorkflowRecompile, templateContext) : renderTemplate(defaultFooter, templateContext);
@@ -182,7 +182,7 @@ function getFooterWorkflowRecompileCommentMessage(ctx) {
182182
const templateContext = toSnakeCase({ ...ctx, agenticWorkflowUrl, effectiveTokens, effectiveTokensFormatted, effectiveTokensSuffix });
183183

184184
// Default footer template
185-
const defaultFooter = "> Updated by [{workflow_name}]({agentic_workflow_url})";
185+
const defaultFooter = "> Updated by [{workflow_name}]({run_url})";
186186

187187
// Use custom workflow recompile comment footer if configured, otherwise use default footer
188188
let footer = messages?.footerWorkflowRecompileComment ? renderTemplate(messages.footerWorkflowRecompileComment, templateContext) : renderTemplate(defaultFooter, templateContext);
@@ -226,7 +226,7 @@ function getFooterAgentFailureIssueMessage(ctx) {
226226
footer = renderTemplate(messages.agentFailureIssue, templateContext);
227227
} else {
228228
// Default footer template with link to workflow run
229-
let defaultFooter = "> Generated from [{workflow_name}]({agentic_workflow_url})";
229+
let defaultFooter = "> Generated from [{workflow_name}]({run_url})";
230230
// Append effective tokens with ● symbol when available (compact format, no "ET" label)
231231
if (effectiveTokens) {
232232
defaultFooter += `{effective_tokens_suffix}`;
@@ -267,7 +267,7 @@ function getFooterAgentFailureCommentMessage(ctx) {
267267
footer = renderTemplate(messages.agentFailureComment, templateContext);
268268
} else {
269269
// Default footer template with link to workflow run
270-
let defaultFooter = "> Generated from [{workflow_name}]({agentic_workflow_url})";
270+
let defaultFooter = "> Generated from [{workflow_name}]({run_url})";
271271
// Append effective tokens with ● symbol when available (compact format, no "ET" label)
272272
if (effectiveTokens) {
273273
defaultFooter += `{effective_tokens_suffix}`;

0 commit comments

Comments
 (0)