Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 22 additions & 22 deletions actions/setup/js/messages.test.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ describe("messages.cjs", () => {
expect(result).toBe("> Generated by [Test Workflow](https://github.com/test/repo/actions/runs/123/custom_path)");
});

it("should include effective tokens from env var when not passed in context", async () => {
it("should not include effective tokens from env var in default footer", async () => {
process.env.GH_AW_EFFECTIVE_TOKENS = "12500";

const { getFooterMessage } = await import("./messages.cjs");
Expand All @@ -364,10 +364,10 @@ describe("messages.cjs", () => {
runUrl: "https://github.com/test/repo/actions/runs/123",
});

expect(result).toBe("> Generated by [Test Workflow](https://github.com/test/repo/actions/runs/123) · 12.5K");
expect(result).toBe("> Generated by [Test Workflow](https://github.com/test/repo/actions/runs/123)");
});

it("should prepend reduced model identifier to effective tokens when engine model is set", async () => {
it("should not append model-prefixed effective tokens in default footer", async () => {
process.env.GH_AW_EFFECTIVE_TOKENS = "12500";
process.env.GH_AW_ENGINE_MODEL = "claude-sonnet-4.6";

Expand All @@ -378,10 +378,10 @@ describe("messages.cjs", () => {
runUrl: "https://github.com/test/repo/actions/runs/123",
});

expect(result).toBe("> Generated by [Test Workflow](https://github.com/test/repo/actions/runs/123) · sonnet46 12.5K");
expect(result).toBe("> Generated by [Test Workflow](https://github.com/test/repo/actions/runs/123)");
});

it("should include effective tokens from env var before history link", async () => {
it("should include history link without effective tokens in default footer", async () => {
process.env.GH_AW_EFFECTIVE_TOKENS = "5000";
const historyUrl = "https://github.com/search?q=repo:test/repo+is:issue&type=issues";

Expand All @@ -393,10 +393,10 @@ describe("messages.cjs", () => {
historyUrl,
});

expect(result).toBe(`> Generated by [Test Workflow](https://github.com/test/repo/actions/runs/123) · 5K · [◷](${historyUrl})`);
expect(result).toBe(`> Generated by [Test Workflow](https://github.com/test/repo/actions/runs/123) · [◷](${historyUrl})`);
});

it("should include AI Credits next to effective tokens when GH_AW_AIC is set", async () => {
it("should include AI Credits without effective tokens when GH_AW_AIC is set", async () => {
process.env.GH_AW_EFFECTIVE_TOKENS = "5000";
process.env.GH_AW_AIC = "0.125";

Expand All @@ -407,7 +407,7 @@ describe("messages.cjs", () => {
runUrl: "https://github.com/test/repo/actions/runs/123",
});

expect(result).toBe("> Generated by [Test Workflow](https://github.com/test/repo/actions/runs/123) · 5K · 0.125 AIC");
expect(result).toBe("> Generated by [Test Workflow](https://github.com/test/repo/actions/runs/123) · 0.125 AIC");
});

it("should not include effective tokens when GH_AW_EFFECTIVE_TOKENS is not set and not passed in context", async () => {
Expand All @@ -424,7 +424,7 @@ describe("messages.cjs", () => {
expect(result).not.toContain("●");
});

it("should prefer effectiveTokens from context over env var", async () => {
it("should ignore context and env effectiveTokens for default footer", async () => {
process.env.GH_AW_EFFECTIVE_TOKENS = "99000";

const { getFooterMessage } = await import("./messages.cjs");
Expand All @@ -435,7 +435,7 @@ describe("messages.cjs", () => {
effectiveTokens: 5000,
});

expect(result).toBe("> Generated by [Test Workflow](https://github.com/test/repo/actions/runs/123) · 5K");
expect(result).toBe("> Generated by [Test Workflow](https://github.com/test/repo/actions/runs/123)");
expect(result).not.toContain("99K");
});

Expand Down Expand Up @@ -522,7 +522,7 @@ describe("messages.cjs", () => {
expect(result).toBe("> Custom: [Test Workflow](https://github.com/test/repo/actions/runs/123) · gpt55 5K");
});

it("should preserve mini-tier gpt identifiers in footer suffixes", async () => {
it("should not include mini-tier model identifiers in default footer suffixes", async () => {
const { getFooterMessage } = await import("./messages.cjs");

const result = getFooterMessage({
Expand All @@ -532,7 +532,7 @@ describe("messages.cjs", () => {
effectiveTokens: 5000,
});

expect(result).toBe("> Generated by [Test Workflow](https://github.com/test/repo/actions/runs/123) · gpt54mini 5K");
expect(result).toBe("> Generated by [Test Workflow](https://github.com/test/repo/actions/runs/123)");
});

it("should append slash command hint when slashCommand is provided", async () => {
Expand All @@ -559,7 +559,7 @@ describe("messages.cjs", () => {
expect(result).not.toContain("<em>");
});

it("should include slash command hint after tokens and history link", async () => {
it("should include slash command hint after history link", async () => {
process.env.GH_AW_EFFECTIVE_TOKENS = "5000";
const historyUrl = "https://github.com/search?q=repo:test";

Expand All @@ -572,7 +572,7 @@ describe("messages.cjs", () => {
slashCommand: "deploy",
});

expect(result).toBe(`> Generated by [Test Workflow](https://github.com/test/repo/actions/runs/123) · 5K · [◷](${historyUrl})\n> <sub>Comment <em>/deploy</em> to run again</sub>`);
expect(result).toBe(`> Generated by [Test Workflow](https://github.com/test/repo/actions/runs/123) · [◷](${historyUrl})\n> <sub>Comment <em>/deploy</em> to run again</sub>`);
});

it("should NOT include slash command hint in custom footer templates", async () => {
Expand Down Expand Up @@ -1018,7 +1018,7 @@ describe("messages.cjs", () => {
expect(result).not.toContain("●");
});

it("should include effective tokens in default footer when env var is set", async () => {
it("should not include effective tokens in default footer when env var is set", async () => {
process.env.GH_AW_EFFECTIVE_TOKENS = "12500";

const { getFooterAgentFailureIssueMessage } = await import("./messages.cjs");
Expand All @@ -1028,10 +1028,10 @@ describe("messages.cjs", () => {
runUrl: "https://github.com/test/repo/actions/runs/123",
});

expect(result).toBe("> Generated from [Test Workflow](https://github.com/test/repo/actions/runs/123) · 12.5K");
expect(result).toBe("> Generated from [Test Workflow](https://github.com/test/repo/actions/runs/123)");
});

it("should include effective tokens before history link in default footer", async () => {
it("should include history link without effective tokens in default footer", async () => {
process.env.GH_AW_EFFECTIVE_TOKENS = "5000";
const historyUrl = "https://github.com/search?q=repo:test/repo+is:issue&type=issues";

Expand All @@ -1043,7 +1043,7 @@ describe("messages.cjs", () => {
historyUrl,
});

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

it("should not include effective tokens in custom footer unless placeholder is used", async () => {
Expand Down Expand Up @@ -1093,7 +1093,7 @@ describe("messages.cjs", () => {
expect(result).not.toContain("●");
});

it("should include effective tokens in default footer when env var is set", async () => {
it("should not include effective tokens in default footer when env var is set", async () => {
process.env.GH_AW_EFFECTIVE_TOKENS = "12500";

const { getFooterAgentFailureCommentMessage } = await import("./messages.cjs");
Expand All @@ -1103,10 +1103,10 @@ describe("messages.cjs", () => {
runUrl: "https://github.com/test/repo/actions/runs/123",
});

expect(result).toBe("> Generated from [Test Workflow](https://github.com/test/repo/actions/runs/123) · 12.5K");
expect(result).toBe("> Generated from [Test Workflow](https://github.com/test/repo/actions/runs/123)");
});

it("should include effective tokens before history link in default footer", async () => {
it("should include history link without effective tokens in default footer", async () => {
process.env.GH_AW_EFFECTIVE_TOKENS = "5000";
const historyUrl = "https://github.com/search?q=repo:test/repo+is:issue&type=issues";

Expand All @@ -1118,7 +1118,7 @@ describe("messages.cjs", () => {
historyUrl,
});

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

it("should not include effective tokens in custom footer unless placeholder is used", async () => {
Expand Down
12 changes: 0 additions & 12 deletions actions/setup/js/messages_footer.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -185,10 +185,6 @@ function getFooterMessage(ctx) {
if (ctx.triggeringNumber) {
defaultFooter += " for issue #{triggering_number}";
}
// Append effective tokens when available (compact format, no "ET" label)
if (effectiveTokens) {
defaultFooter += effectiveTokensSuffix;
}
if (aiCredits) {
defaultFooter += aiCreditsSuffix;
}
Expand Down Expand Up @@ -328,10 +324,6 @@ function getFooterAgentFailureIssueMessage(ctx) {
} else {
// Default footer template with link to workflow run
let defaultFooter = "> Generated from [{workflow_name}]({run_url})";
// Append effective tokens when available (compact format, no "ET" label)
if (effectiveTokens) {
defaultFooter += `{effective_tokens_suffix}`;
}
// Append history link when available
if (ctx.historyUrl) {
defaultFooter += " · [◷]({history_url})";
Expand Down Expand Up @@ -370,10 +362,6 @@ function getFooterAgentFailureCommentMessage(ctx) {
} else {
// Default footer template with link to workflow run
let defaultFooter = "> Generated from [{workflow_name}]({run_url})";
// Append effective tokens when available (compact format, no "ET" label)
if (effectiveTokens) {
defaultFooter += `{effective_tokens_suffix}`;
}
// Append history link when available
if (ctx.historyUrl) {
defaultFooter += " · [◷]({history_url})";
Expand Down