fix: update code examples to use ES6 module syntax as required by actions/core v3.0.0#67
Merged
FidelusAleksander merged 5 commits intomainfrom Mar 10, 2026
Merged
Conversation
* refactor: update joke fetching logic to use ES6 module syntax * style: format code snippets for consistency in Step 2 document
Contributor
There was a problem hiding this comment.
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 initcommand in step 1 to also set"type": "module"inpackage.jsonvianpm pkg set type=module. - Converted
require/module.exportstoimport/export defaultin thesrc/joke.jscode example in step 2. - Converted
requiretoimportstatements in thesrc/main.jscode 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.
chriswblake
approved these changes
Mar 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
.github/steps/1-step.mdto set the package type tomodule, enabling ES module syntax.Source code refactoring for ES modules:
requirestatements toimportstatements insrc/joke.jsandsrc/main.jsto use ES module syntax. [1] [2]src/joke.jsfrommodule.exportstoexport defaultfor ES module compatibility.Changes
Closes: #65
Task list