Skip to content

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Sep 20, 2025

The GitHub Actions workflow for distributing feature files was failing with an ES Module import error:

Error [ERR_REQUIRE_ESM]: require() of ES Module /home/runner/work/.github/.github/node_modules/@octokit/rest/dist-src/index.js from /home/runner/work/.github/.github/[stdin] not supported.
Instead change the require of index.js in /home/runner/work/.github/.github/[stdin] to a dynamic import() which is available in all CommonJS modules.

Root Cause: The @octokit/rest package was upgraded to version 22.0.0+ which became ES module only, breaking the CommonJS require() syntax used in both the GitHub Actions inline script and the manual distribution script.

Solution: Pin @octokit/rest to version 20.1.2, which is the last version that supports CommonJS require() syntax. This maintains backward compatibility without requiring a complete rewrite of the scripts to use ES module syntax.

Changes Made:

  • Updated .github/workflows/distribute-features.yml to install @octokit/rest@20.1.2 specifically
  • Added documentation in scripts/README.md explaining the version requirement
  • Created .gitignore to prevent accidental commits of node_modules

Testing: Verified that both the GitHub Actions inline script and the manual scripts/distribute-features-manual.js script work correctly with the pinned version.

This fix ensures the feature distribution workflow runs successfully without breaking existing functionality or requiring major code changes.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 2 commits September 20, 2025 11:22
Co-authored-by: devinschumacher <45643901+devinschumacher@users.noreply.github.com>
Co-authored-by: devinschumacher <45643901+devinschumacher@users.noreply.github.com>
@Copilot Copilot AI changed the title [WIP] 0s Run node << 'EOF' node << 'EOF' const { Octokit } = require('@octokit/rest'); const fs = require('fs'); const path = require('path'); const octokit = new Octokit({ auth: process.env.GITHUB_TOKEN }); async function distributeF... Fix @octokit/rest ESM compatibility error in feature distribution workflow Sep 20, 2025
@Copilot Copilot AI requested a review from devinschumacher September 20, 2025 11:26
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