diff --git a/.github/steps/1-step.md b/.github/steps/1-step.md index 3780367..29c6b2b 100644 --- a/.github/steps/1-step.md +++ b/.github/steps/1-step.md @@ -48,7 +48,7 @@ Now that your Codespace is ready, let's initialize a new Node.js project and ins 1. Within your GitHub Codespace terminal window initialize a new project: ```sh - npm init -y + npm init -y && npm pkg set type=module ``` 1. Install the required dependencies: diff --git a/.github/steps/2-step.md b/.github/steps/2-step.md index 03038db..3ee73a3 100644 --- a/.github/steps/2-step.md +++ b/.github/steps/2-step.md @@ -7,11 +7,10 @@ Nice! Now that we have the project initialized and dependencies installed, it's The `@actions/core` library is the main library from the [GitHub Actions Toolkit](https://github.com/actions/toolkit), a collection of packages for building JavaScript GitHub Actions. It provides essential methods to interact with the GitHub Actions runtime environment, accept action inputs, and produce outputs for other workflow steps. > [!TIP] -> The [GitHub Actions Toolkit](https://github.com/actions/toolkit) includes other useful libraries like `@actions/github` for interacting with the GitHub API and `@actions/artifact` for uploading and downloading artifacts. -> +> The [GitHub Actions Toolkit](https://github.com/actions/toolkit) includes other useful libraries like `@actions/github` for interacting with the GitHub API and `@actions/artifact` for uploading and downloading artifacts. +> > Visit the [actions/toolkit](https://github.com/actions/toolkit) repository for more. - ### ⌨️ Activity: Implement the Dad Jokes Action Let's create the source files and implement the logic for your action. @@ -21,7 +20,7 @@ Let's create the source files and implement the logic for your action. 1. Create `src/joke.js` file to hold the logic for fetching a joke from the `icanhazdadjoke.com` API: ```js - const request = require("request-promise"); + import request from "request-promise"; const options = { method: "GET", @@ -38,7 +37,7 @@ Let's create the source files and implement the logic for your action. return res.joke; } - module.exports = getJoke; + export default getJoke; ``` The `getJoke` function makes an HTTP GET request to the `icanhazdadjoke.com` API and returns a random dad joke. @@ -48,8 +47,8 @@ Let's create the source files and implement the logic for your action. 1. Create `src/main.js` that will be the main entry point for your action: ```js - const getJoke = require("./joke"); - const core = require("@actions/core"); + import getJoke from "./joke.js"; + import * as core from "@actions/core"; async function run() { const joke = await getJoke();