44const { getErrorMessage } = require ( "./error_helpers.cjs" ) ;
55const { getMessages } = require ( "./messages_core.cjs" ) ;
66const { sanitizeContent } = require ( "./sanitize_content.cjs" ) ;
7+ const { getPullRequestCreatedMessage, getIssueCreatedMessage, getCommitPushedMessage } = require ( "./messages_run_status.cjs" ) ;
8+ const { parseBoolTemplatable } = require ( "./templatable.cjs" ) ;
9+ const { generateXMLMarker } = require ( "./generate_footer.cjs" ) ;
10+
11+ /**
12+ * Build the workflow run URL from context and environment.
13+ * @param {any } context - GitHub Actions context
14+ * @returns {string } The workflow run URL
15+ */
16+ function getRunUrl ( context ) {
17+ const runId = context . runId || process . env . GITHUB_RUN_ID || "" ;
18+ const githubServer = process . env . GITHUB_SERVER_URL || "https://github.com" ;
19+ return context . payload ?. repository ?. html_url ? `${ context . payload . repository . html_url } /actions/runs/${ runId } ` : `${ githubServer } /${ context . repo . owner } /${ context . repo . repo } /actions/runs/${ runId } ` ;
20+ }
721
822/**
923 * Update the activation comment with a link to the created pull request or issue
@@ -16,7 +30,10 @@ const { sanitizeContent } = require("./sanitize_content.cjs");
1630 */
1731async function updateActivationComment ( github , context , core , itemUrl , itemNumber , itemType = "pull_request" ) {
1832 const itemLabel = itemType === "issue" ? "issue" : "pull request" ;
19- const linkMessage = itemType === "issue" ? `\n\n✅ Issue created: [#${ itemNumber } ](${ itemUrl } )` : `\n\n✅ Pull request created: [#${ itemNumber } ](${ itemUrl } )` ;
33+ const workflowName = process . env . GH_AW_WORKFLOW_NAME || "Workflow" ;
34+ const runUrl = getRunUrl ( context ) ;
35+ const body = itemType === "issue" ? getIssueCreatedMessage ( { itemNumber, itemUrl } ) : getPullRequestCreatedMessage ( { itemNumber, itemUrl } ) ;
36+ const linkMessage = `\n\n${ body } \n\n${ generateXMLMarker ( workflowName , runUrl ) } ` ;
2037 await updateActivationCommentWithMessage ( github , context , core , linkMessage , itemLabel , { targetIssueNumber : itemNumber } ) ;
2138}
2239
@@ -32,7 +49,9 @@ async function updateActivationComment(github, context, core, itemUrl, itemNumbe
3249 */
3350async function updateActivationCommentWithCommit ( github , context , core , commitSha , commitUrl , options = { } ) {
3451 const shortSha = commitSha . substring ( 0 , 7 ) ;
35- const message = `\n\n✅ Commit pushed: [\`${ shortSha } \`](${ commitUrl } )` ;
52+ const workflowName = process . env . GH_AW_WORKFLOW_NAME || "Workflow" ;
53+ const runUrl = getRunUrl ( context ) ;
54+ const message = `\n\n${ getCommitPushedMessage ( { commitSha, shortSha, commitUrl } ) } \n\n${ generateXMLMarker ( workflowName , runUrl ) } ` ;
3655 await updateActivationCommentWithMessage ( github , context , core , message , "commit" , options ) ;
3756}
3857
@@ -54,6 +73,12 @@ async function updateActivationCommentWithMessage(github, context, core, message
5473 const messagesConfig = getMessages ( ) ;
5574 const appendOnlyComments = messagesConfig ?. appendOnlyComments === true ;
5675
76+ // Check if activation comments are disabled entirely
77+ if ( ! parseBoolTemplatable ( messagesConfig ?. activationComments , true ) ) {
78+ core . info ( "activation-comments is disabled: skipping activation comment update" ) ;
79+ return ;
80+ }
81+
5782 // Parse comment repo (format: "owner/repo") with validation
5883 let repoOwner = context . repo . owner ;
5984 let repoName = context . repo . repo ;
0 commit comments