@@ -456,6 +456,88 @@ describe("messages.cjs", () => {
456456
457457 expect ( result ) . toBe ( "> Custom: [Test Workflow](https://github.com/test/repo/actions/runs/123) · gpt55 5K" ) ;
458458 } ) ;
459+
460+ it ( "should append slash command hint when slashCommand is provided" , async ( ) => {
461+ const { getFooterMessage } = await import ( "./messages.cjs" ) ;
462+
463+ const result = getFooterMessage ( {
464+ workflowName : "Test Workflow" ,
465+ runUrl : "https://github.com/test/repo/actions/runs/123" ,
466+ slashCommand : "review-bot" ,
467+ } ) ;
468+
469+ expect ( result ) . toBe ( "> Generated by [Test Workflow](https://github.com/test/repo/actions/runs/123)\n> <sub>Comment <em>/review-bot</em> to run again</sub>" ) ;
470+ } ) ;
471+
472+ it ( "should not append slash command hint when slashCommand is not provided" , async ( ) => {
473+ const { getFooterMessage } = await import ( "./messages.cjs" ) ;
474+
475+ const result = getFooterMessage ( {
476+ workflowName : "Test Workflow" ,
477+ runUrl : "https://github.com/test/repo/actions/runs/123" ,
478+ } ) ;
479+
480+ expect ( result ) . not . toContain ( "<sub>" ) ;
481+ expect ( result ) . not . toContain ( "<em>" ) ;
482+ } ) ;
483+
484+ it ( "should include slash command hint after tokens and history link" , async ( ) => {
485+ process . env . GH_AW_EFFECTIVE_TOKENS = "5000" ;
486+ const historyUrl = "https://github.com/search?q=repo:test" ;
487+
488+ const { getFooterMessage } = await import ( "./messages.cjs" ) ;
489+
490+ const result = getFooterMessage ( {
491+ workflowName : "Test Workflow" ,
492+ runUrl : "https://github.com/test/repo/actions/runs/123" ,
493+ historyUrl,
494+ slashCommand : "deploy" ,
495+ } ) ;
496+
497+ 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>` ) ;
498+ } ) ;
499+
500+ it ( "should NOT include slash command hint in custom footer templates" , async ( ) => {
501+ process . env . GH_AW_SAFE_OUTPUT_MESSAGES = JSON . stringify ( {
502+ footer : "> Custom: [{workflow_name}]({run_url})" ,
503+ } ) ;
504+
505+ const { getFooterMessage } = await import ( "./messages.cjs" ) ;
506+
507+ const result = getFooterMessage ( {
508+ workflowName : "Test Workflow" ,
509+ runUrl : "https://github.com/test/repo/actions/runs/123" ,
510+ slashCommand : "review-bot" ,
511+ } ) ;
512+
513+ expect ( result ) . toBe ( "> Custom: [Test Workflow](https://github.com/test/repo/actions/runs/123)" ) ;
514+ expect ( result ) . not . toContain ( "<sub>" ) ;
515+ } ) ;
516+
517+ it ( "should use slashCommandPlaceholder as hint text when provided" , async ( ) => {
518+ const { getFooterMessage } = await import ( "./messages.cjs" ) ;
519+
520+ const result = getFooterMessage ( {
521+ workflowName : "Test Workflow" ,
522+ runUrl : "https://github.com/test/repo/actions/runs/123" ,
523+ slashCommand : "review-bot" ,
524+ slashCommandPlaceholder : "to review this PR" ,
525+ } ) ;
526+
527+ expect ( result ) . toBe ( "> Generated by [Test Workflow](https://github.com/test/repo/actions/runs/123)\n> <sub>Comment <em>/review-bot</em> to review this PR</sub>" ) ;
528+ } ) ;
529+
530+ it ( "should fall back to 'to run again' when slashCommandPlaceholder is not provided" , async ( ) => {
531+ const { getFooterMessage } = await import ( "./messages.cjs" ) ;
532+
533+ const result = getFooterMessage ( {
534+ workflowName : "Test Workflow" ,
535+ runUrl : "https://github.com/test/repo/actions/runs/123" ,
536+ slashCommand : "review-bot" ,
537+ } ) ;
538+
539+ expect ( result ) . toContain ( "to run again" ) ;
540+ } ) ;
459541 } ) ;
460542
461543 describe ( "getFooterInstallMessage" , ( ) => {
@@ -576,6 +658,57 @@ describe("messages.cjs", () => {
576658 delete process . env . GH_AW_ENGINE_VERSION ;
577659 delete process . env . GH_AW_ENGINE_MODEL ;
578660 } ) ;
661+
662+ it ( "should include slash command hint when GH_AW_COMMANDS is set" , async ( ) => {
663+ process . env . GH_AW_COMMANDS = JSON . stringify ( [ "review-bot" ] ) ;
664+
665+ const { generateFooterWithMessages } = await import ( "./messages.cjs" ) ;
666+
667+ const result = generateFooterWithMessages ( "Test Workflow" , "https://github.com/test/repo/actions/runs/123" , "" , "" , undefined , undefined , undefined ) ;
668+
669+ expect ( result ) . toContain ( "<sub>Comment <em>/review-bot</em> to run again</sub>" ) ;
670+
671+ delete process . env . GH_AW_COMMANDS ;
672+ } ) ;
673+
674+ it ( "should not include slash command hint when GH_AW_COMMANDS is not set" , async ( ) => {
675+ delete process . env . GH_AW_COMMANDS ;
676+
677+ const { generateFooterWithMessages } = await import ( "./messages.cjs" ) ;
678+
679+ const result = generateFooterWithMessages ( "Test Workflow" , "https://github.com/test/repo/actions/runs/123" , "" , "" , undefined , undefined , undefined ) ;
680+
681+ expect ( result ) . not . toContain ( "<sub>" ) ;
682+ expect ( result ) . not . toContain ( "<em>" ) ;
683+ } ) ;
684+
685+ it ( "should use first command from GH_AW_COMMANDS when multiple commands are configured" , async ( ) => {
686+ process . env . GH_AW_COMMANDS = JSON . stringify ( [ "deploy" , "analyze" ] ) ;
687+
688+ const { generateFooterWithMessages } = await import ( "./messages.cjs" ) ;
689+
690+ const result = generateFooterWithMessages ( "Test Workflow" , "https://github.com/test/repo/actions/runs/123" , "" , "" , undefined , undefined , undefined ) ;
691+
692+ expect ( result ) . toContain ( "<sub>Comment <em>/deploy</em> to run again</sub>" ) ;
693+ expect ( result ) . not . toContain ( "/analyze" ) ;
694+
695+ delete process . env . GH_AW_COMMANDS ;
696+ } ) ;
697+
698+ it ( "should use GH_AW_COMMAND_PLACEHOLDER as hint text when set" , async ( ) => {
699+ process . env . GH_AW_COMMANDS = JSON . stringify ( [ "review-bot" ] ) ;
700+ process . env . GH_AW_COMMAND_PLACEHOLDER = "to analyze this PR" ;
701+
702+ const { generateFooterWithMessages } = await import ( "./messages.cjs" ) ;
703+
704+ const result = generateFooterWithMessages ( "Test Workflow" , "https://github.com/test/repo/actions/runs/123" , "" , "" , undefined , undefined , undefined ) ;
705+
706+ expect ( result ) . toContain ( "<sub>Comment <em>/review-bot</em> to analyze this PR</sub>" ) ;
707+ expect ( result ) . not . toContain ( "to run again" ) ;
708+
709+ delete process . env . GH_AW_COMMANDS ;
710+ delete process . env . GH_AW_COMMAND_PLACEHOLDER ;
711+ } ) ;
579712 } ) ;
580713
581714 describe ( "generateXMLMarker" , ( ) => {
0 commit comments