Skip to content

Free, Open Source, Self-Hosted WhatsApp API Gateway

docs(scripts): say an npm audit outage still fails the audit job

Yudhi Armyndharisc2b816d1bba9
diff --git a/scripts/check-audit.mjs b/scripts/check-audit.mjs
index fd788732b..ce504a0b5 100644
--- a/scripts/check-audit.mjs
+++ b/scripts/check-audit.mjs
@@ -109,11 +109,12 @@ export function collectAdvisories(report) {
}
/**
- * What to do when npm audit could not answer at all. PR and push CI skip, so an npm outage does not
- * block every merge, but the skip is raised as a warning annotation on GitHub Actions rather than a
- * log line inside a green job. A path that sets CHECK_AUDIT_REQUIRED=1 (the release gate and the
- * weekly scan) fails instead: publishing, or reporting a week clean, with no advisory checked is not
- * a skip those paths may take. A re-run clears a transient outage.
+ * What to do when npm audit could not answer at all. On PR and push CI only this root-tree check
+ * skips, and the skip is raised as a warning annotation on GitHub Actions rather than a log line
+ * inside a green step. It does not keep the audit job green: the dashboard's plain `npm audit` step
+ * in ci.yml fails closed on the same outage. A path that sets CHECK_AUDIT_REQUIRED=1 (the release
+ * gate and the weekly scan) fails instead: publishing, or reporting a week clean, with no advisory
+ * checked is not a skip those paths may take. A re-run clears a transient outage.
*/
export function unavailableOutcome(summary, env = process.env) {
const required = env.CHECK_AUDIT_REQUIRED === '1';
@@ -177,9 +178,9 @@ if (process.argv[1] && realpathSync(process.argv[1]) === fileURLToPath(import.me
const report = runAudit();
// A registry that cannot answer the audit request must not be read as a clean tree. On a merge
- // path, blocking every merge while npm's audit endpoint is down (or being retired) is worse than
- // the risk of a missed advisory for the duration, so it skips loudly; a required path fails. See
- // unavailableOutcome.
+ // path this step skips loudly rather than failing while npm's audit endpoint is down (or being
+ // retired). That keeps the root step from failing, not the audit job green: the dashboard audit
+ // step fails closed on the same outage. A required path fails. See unavailableOutcome.
if (auditUnavailable(report)) {
const outcome = unavailableOutcome(report?.error?.summary ?? 'no report');
for (const line of outcome.lines) console.log(line);