* Build comment body with tracker ID and footer * @param {string} body - The original comment body * @param {number|undefined} triggeringIssueNumber - Issue number that triggered this workflow * @param {number|undefined} triggeringPRNumber - PR number that triggered this workflow * @returns {str
(body, triggeringIssueNumber, triggeringPRNumber)
| 48 | * @returns {string} The complete comment body with tracker ID and footer |
| 49 | */ |
| 50 | function buildCommentBody(body, triggeringIssueNumber, triggeringPRNumber) { |
| 51 | const workflowName = process.env.GH_AW_WORKFLOW_NAME || "Workflow"; |
| 52 | const workflowSource = process.env.GH_AW_WORKFLOW_SOURCE || ""; |
| 53 | const workflowSourceURL = process.env.GH_AW_WORKFLOW_SOURCE_URL || ""; |
| 54 | const runUrl = buildWorkflowRunUrl(context, context.repo); |
| 55 | |
| 56 | // Inject CAUTION at top of body if threat detection warning was raised. |
| 57 | // Caller is responsible for sanitizing body before passing it here. |
| 58 | const detectionCaution = getDetectionCautionAlert(workflowName, runUrl); |
| 59 | const bodyWithCaution = detectionCaution ? detectionCaution + "\n\n" + body.trim() : body.trim(); |
| 60 | return bodyWithCaution + getTrackerID("markdown") + generateFooterWithMessages(workflowName, runUrl, workflowSource, workflowSourceURL, triggeringIssueNumber, triggeringPRNumber, undefined, undefined, { skipDetectionCaution: true }); |
| 61 | } |
| 62 | |
| 63 | /** |
| 64 | * Check if labels match the required labels filter |
no test coverage detected