Skip to content

fix: update code examples to use ES6 module syntax as required by actions/core v3.0.0#67

Merged
FidelusAleksander merged 5 commits intomainfrom
es-module-fixes
Mar 10, 2026
Merged

fix: update code examples to use ES6 module syntax as required by actions/core v3.0.0#67
FidelusAleksander merged 5 commits intomainfrom
es-module-fixes

Conversation

@FidelusAleksander
Copy link
Copy Markdown
Contributor

Summary

This pull request updates the project setup and source files to use ES modules instead of CommonJS, and ensures compatibility with modern JavaScript syntax. The changes are mainly focused on updating initialization steps and refactoring import/export statements.

Project setup modernization:

  • Updated the Node.js project initialization command in .github/steps/1-step.md to set the package type to module, enabling ES module syntax.

Source code refactoring for ES modules:

  • Changed require statements to import statements in src/joke.js and src/main.js to use ES module syntax. [1] [2]
  • Updated the export in src/joke.js from module.exports to export default for ES module compatibility.

Changes

Closes: #65

Task list

  • For workflow changes, I have verified the Actions workflows function as expected.
  • For content changes, I have reviewed the style guide.

skravops-cmd and others added 4 commits March 10, 2026 10:41
* refactor: update joke fetching logic to use ES6 module syntax

* style: format code snippets for consistency in Step 2 document
Copilot AI review requested due to automatic review settings March 10, 2026 09:49
@FidelusAleksander FidelusAleksander requested a review from a team March 10, 2026 09:50
Copy link
Copy Markdown
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 migrates the JavaScript code examples in a GitHub Skills exercise ("Write JavaScript Actions") from CommonJS (require/module.exports) to ES module syntax (import/export default). This is necessary because the project is being configured as an ES module (via "type": "module" in package.json), which resolves issue #65 where running node src/main.js failed due to a mismatch between module systems.

Changes:

  • Updated the npm init command in step 1 to also set "type": "module" in package.json via npm pkg set type=module.
  • Converted require/module.exports to import/export default in the src/joke.js code example in step 2.
  • Converted require to import statements in the src/main.js code example in step 2.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
.github/steps/1-step.md Appends npm pkg set type=module to the project initialization command to enable ES modules.
.github/steps/2-step.md Converts code examples for joke.js and main.js from CommonJS to ES module syntax.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@FidelusAleksander FidelusAleksander merged commit 68c8af5 into main Mar 10, 2026
2 checks passed
@FidelusAleksander FidelusAleksander deleted the es-module-fixes branch March 10, 2026 10:30
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.

[Bug] Lab does not work - Step 2.4

4 participants