Skip to content

Conversation

@joshjohanning
Copy link
Owner

Adds a Node.js implementation of the CODEOWNERS file management script with improved capabilities.

Changes

  • New scripts/add-codeowners-to-repositories/ directory with Node.js solution
  • Uses Octokit for GitHub API interactions
  • Adds concurrency control for parallel processing (configurable, default: 10)
  • Includes automatic retry logic for rate limits
  • Supports dry-run mode to preview changes
  • Tracks and reports API call usage

Features

  • Append (default) or overwrite existing CODEOWNERS files
  • Checks all standard CODEOWNERS locations (root, .github/, docs/)
  • Progress reporting with percentage complete
  • GitHub Enterprise Server support via GITHUB_API_URL

Usage

cd scripts/add-codeowners-to-repositories
npm install
node add-codeowners-to-repositories.js --repos-file repos.txt --codeowners ./CODEOWNERS

Copilot AI review requested due to automatic review settings January 29, 2026 17:18
@github-actions
Copy link

github-actions bot commented Jan 29, 2026

📋 Lint Results

⚡ ./gh-cli scripts

✅ No issues found.

🔧 ./scripts scripts

✅ No issues found.

Lint results updated at Fri Jan 30 20:33:11 UTC 2026

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a Node.js implementation of a CODEOWNERS file management script along with two bash scripts for comparing package.json contents across repositories.

Changes:

  • New scripts/add-codeowners-to-repositories/ directory containing a Node.js script for managing CODEOWNERS files with features like concurrency control, dry-run mode, and retry logic
  • Two new bash scripts in gh-cli/ for comparing package.json scripts and devDependencies across multiple repositories
  • Updated gh-cli/README.md with entries for the two new comparison scripts

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
scripts/add-codeowners-to-repositories/package.json Defines dependencies and metadata for the Node.js CODEOWNERS management script
scripts/add-codeowners-to-repositories/add-codeowners-to-repositories.js Main Node.js script implementing CODEOWNERS file management with append/overwrite modes, concurrency control, and retry logic
scripts/add-codeowners-to-repositories/README.md Documentation for the CODEOWNERS management script including usage, options, and examples
gh-cli/compare-package-scripts-across-repositories.sh Bash script to compare package.json scripts across repositories to identify differences
gh-cli/compare-dev-dependencies-across-repositories.sh Bash script to compare devDependencies in package.json across repositories with version mismatch detection
gh-cli/README.md Updates to document the two new comparison scripts in alphabetical order
Comments suppressed due to low confidence (1)

scripts/add-codeowners-to-repositories/add-codeowners-to-repositories.js:311

  • The defaultBranch variable is retrieved but never used in the function. This variable retrieval adds an unnecessary API call. Consider removing the call to getDefaultBranch if the default branch information is not needed, or use it if there's a specific reason (e.g., to validate the repository or include it in logging/reporting).
    const defaultBranch = await getDefaultBranch(octokit, org, repo);

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

@joshjohanning joshjohanning enabled auto-merge (squash) January 30, 2026 20:33
@joshjohanning joshjohanning merged commit ca52cd9 into main Jan 30, 2026
6 checks passed
@joshjohanning joshjohanning deleted the codeowner-node-script branch January 30, 2026 20:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants