Skip to content

[eslint-monster] [lint-monster] setup/js: guard JSON.parse call sites with try/catch #43632

Description

@github-actions

Scope

Remediate gh-aw-custom/require-json-parse-try-catch warnings under actions/setup/js.

Affected files

  • actions/setup/js/add_reaction_and_edit_comment.cjs
  • actions/setup/js/apply_safe_outputs_replay.cjs
  • actions/setup/js/artifact_client.cjs
  • actions/setup/js/build_checkout_manifest.cjs
  • actions/setup/js/convert_gateway_config_shared.cjs
  • actions/setup/js/generate_safe_outputs_tools.cjs
  • actions/setup/js/generate_workflow_overview.cjs
  • actions/setup/js/mcp_scripts_config_loader.cjs
  • actions/setup/js/patch_awf_chroot_config.cjs
  • actions/setup/js/route_slash_command.cjs
  • actions/setup/js/safe_outputs_handlers.cjs
  • actions/setup/js/safe_outputs_tools_loader.cjs

Representative diagnostics

  • add_reaction_and_edit_comment.cjs:143 — Wrap JSON.parse(commandsJSON) in try/catch.
  • convert_gateway_config_shared.cjs:82 — Wrap JSON.parse(process.env.GH_AW_MCP_CLI_SERVERS || "[]") in try/catch.
  • generate_safe_outputs_tools.cjs:98 — Wrap JSON.parse(fs.readFileSync(toolsSourcePath, "utf8")) in try/catch.
  • route_slash_command.cjs:641 — Wrap JSON.parse(process.env.GH_AW_SLASH_ROUTING || "{}") in try/catch.
  • safe_outputs_handlers.cjs:53 — Wrap JSON.parse(fs.readFileSync(filePath, "utf8")) in try/catch.

Expected outcome

All JSON.parse(...) operations in these setup runtime scripts should fail safely with explicit error handling, preserving actionable diagnostics instead of crashing the entrypoint.

Checklist

  • Audit each listed parse site and group nearby calls behind shared helpers where appropriate
  • Add try/catch with context-rich error messages and safe fallbacks or explicit throws, matching surrounding script behavior
  • Keep changes scoped to actions/setup/js
  • Run npm run lint:setup-js

Generated by 🧹 ESLint Monster · 18.5 AIC · ⌖ 7.96 AIC · ⊞ 1.5K ·

  • expires on Jul 12, 2026, 2:18 PM UTC-08:00

Metadata

Metadata

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions