Skip to content

Fix update-readme.yml: remove broken npm install, fix paths, rewrite script as self-contained CJS#4

Merged
jaseel0 merged 2 commits intomainfrom
copilot/fix-update-readme-yml
Mar 9, 2026
Merged

Fix update-readme.yml: remove broken npm install, fix paths, rewrite script as self-contained CJS#4
jaseel0 merged 2 commits intomainfrom
copilot/fix-update-readme-yml

Conversation

Copy link
Contributor

Copilot AI commented Mar 9, 2026

The update-readme.yml workflow was broken in four ways: npm install failed with ENOENT (no package.json exists), the script path was wrong, the script itself used ES module syntax without a module-type declaration and depended on a leaderboard.md that nothing generated, and git add targeted the wrong file.

Changes

  • Workflow (update-readme.yml)

    • Drop npm install — only built-in Node.js modules are used
    • Fix script path: scripts/updateReadme.jsprofile/scripts/updateReadme.js
    • Fix commit step: git add README.mdgit add profile/README.md
  • Script (profile/scripts/updateReadme.js)

    • Rewrite from incomplete ESM stub into a self-contained CommonJS script
    • Uses built-in https to fetch org repos, commit contributors, merged PRs, and issues from the GitHub REST API directly — no leaderboard.md intermediary, no npm deps
    • Generates and writes the full leaderboard table into profile/README.md between marker comments
  • profile/README.md

    • Add <!-- LEADERBOARD START --> / <!-- LEADERBOARD END --> markers around the existing table so the regex replacement has valid anchors
// Before: broken ESM, reads a file that never existed
import fs from 'fs';
const leaderboardTable = fs.readFileSync('./leaderboard.md', 'utf8');

// After: CommonJS, fetches live data, writes directly
const repos = await getAllPages(`/orgs/${ORG}/repos?type=public`);
// ...aggregate commits/PRs/issues per contributor...
readme = readme.replace(
  /<!-- LEADERBOARD START -->[\s\S]*?<!-- LEADERBOARD END -->/,
  `<!-- LEADERBOARD START -->\n${table}\n<!-- LEADERBOARD END -->`
);

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Co-authored-by: jaseel0 <225665919+jaseel0@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix errors related to package.json not found Fix update-readme.yml: remove broken npm install, fix paths, rewrite script as self-contained CJS Mar 9, 2026
@jaseel0 jaseel0 added documentation Improvements or additions to documentation profile javascript ci labels Mar 9, 2026
@naheel0 naheel0 marked this pull request as ready for review March 9, 2026 16:14
@naheel0 naheel0 requested a review from jaseel0 as a code owner March 9, 2026 16:14
@jaseel0 jaseel0 merged commit 00f719f into main Mar 9, 2026
1 of 3 checks passed
@jaseel0 jaseel0 deleted the copilot/fix-update-readme-yml branch March 9, 2026 16:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci documentation Improvements or additions to documentation javascript profile

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants