Skip to content

[eslint-monster] setup/js lint stream 2: wrap sync fs and sync exec I/O in try/catch #47412

Description

@github-actions

Summary

Daily npm run lint:setup-js found a broad reliability stream in actions/setup/js where synchronous filesystem and child-process calls can throw and crash the action when unhandled.

Root cause group

Unhandled sync I/O in production scripts: fs.statSync, fs.readdirSync, fs.copyFileSync, execFileSync, and execSync are used without local try/catch guards.

Affected files

  • actions/setup/js/artifact_client.cjs
  • actions/setup/js/build_checkout_manifest.cjs
  • actions/setup/js/check_workflow_timestamp.cjs
  • actions/setup/js/comment_memory_helpers.cjs
  • actions/setup/js/generate_git_bundle.cjs
  • actions/setup/js/generate_git_patch.cjs
  • actions/setup/js/install_frontmatter_skills.cjs
  • actions/setup/js/merge_remote_agent_github_folder.cjs
  • actions/setup/js/push_experiment_state.cjs
  • actions/setup/js/push_repo_memory.cjs
  • actions/setup/js/run_evals.cjs
  • actions/setup/js/runtime_import.cjs
  • actions/setup/js/safe_outputs_handlers.cjs
  • actions/setup/js/setup_threat_detection.cjs

Representative diagnostics

  • artifact_client.cjs:211:17Wrap fs.statSync(filePath) in try/catch
  • build_checkout_manifest.cjs:44:65Wrap execFileSync("git") in try/catch
  • check_workflow_timestamp.cjs:55:24Wrap fs.statSync(workflowMdFile) in try/catch
  • merge_remote_agent_github_folder.cjs:276:7Wrap fs.copyFileSync(sourceFile) in try/catch
  • safe_outputs_handlers.cjs:2027:9Wrap fs.copyFileSync(srcPath) in try/catch

Expected outcome

Guard sync fs/exec calls with targeted try/catch handling that preserves current behavior where possible, converts crashes into actionable errors, and keeps lint clean for the affected rules.

Checklist

  • Add try/catch guards around sync fs and sync exec calls in the files above
  • Preserve existing success-path behavior and actionable failure messages
  • Run npm run lint:setup-js
  • Confirm this remediation stream is clean

Generated by 🧹 ESLint Monster · gpt54 25.8 AIC · ⌖ 8 AIC · ⊞ 4K ·

  • expires on Jul 29, 2026, 2:20 PM UTC-08:00

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions