(client, sessionID, job)
| 698 | } |
| 699 | |
| 700 | async function notifyJob(directory, job, reason) { |
| 701 | if (!job.notifyCommand) return |
| 702 | const command = String(job.notifyCommand).replace(/\{reason\}/g, String(reason || "")).replace(/\{job\}/g, String(job.name || job.id || "")) |
| 703 | await runShellCommand(command, directory, 60_000) |
| 704 | } |
| 705 | |
| 706 | function dangerousShell(command) { |
| 707 | const text = String(command || "").toLowerCase() |
| 708 | return [/\brm\s+-rf\b/, /\bgit\s+reset\b/, /\bgit\s+clean\b/, /\bgit\s+push\b/, /\bdel\s+\/s\b/, /\brmdir\s+\/s\b/, /\bformat\b/, /\bterraform\s+destroy\b/, /\bkubectl\s+delete\b/, /\bdeploy\b.*\bproduction\b/].some((pattern) => pattern.test(text)) |
| 709 | } |
| 710 | |
| 711 | function actionKind(action, job = {}) { |
| 712 | const text = String(action || "").trim() |
no test coverage detected