Skip to content

jcbhmr/hello-world-deno-action

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

"Hello world!" GitHub Action using Deno

🦕 Demo action using Deno
💡 Inspired by actions/hello-world-javascript-action

import * as core from "npm:@actions/core";
import * as github from "npm:@actions/github";
console.log(`Hello ${core.getInput("name")}!`);
core.setOutput("time", new Date().toLocaleTimeString());

🟦 Uses TypeScript
🦕 Runs on the Deno runtime
👩‍⚖️ 0BSD licensed template

Usage

Deno GitHub Actions

This is a template repository that is meant to be used as a base or example for your own project. To get started, just click the Use this template button in the top left of this repository page and edit the main.ts file to customize your new Deno-based GitHub Action.

After instantiating this template repository, you will need to manually do the following:

  1. Write your code in the main.ts file. You can use npm: specifiers, http: imports, node: builtins, and even Deno.* APIs.
  2. Make sure you edit the .github/workflows/test-action.yml test workflow if you want to test any additional inputs or scenarios.
  3. Replace the LICENSE file with your preferred software license. Check out choosealicense.com if you're unsure of which one to pick.
  4. Replace this README.md file with a fancy readme to suit your new GitHub Action. Make sure you document all your inputs & outputs!
  5. Trigger the Draft release workflow manually to create a Draft release with the compiled Deno binaries embedded in the repository. After the workflow completes, you'll see a Draft item in the Releases tab. Now you can publish your new GitHub Action to the GitHub Actions Marketplace! 🚀

You'll notice that the example code uses npm: imports to directly import from npm. If you want to get more advanced, you can use an import map in a deno.json Deno configuration file to alias @actions/core to a specific version shared across your action.

// deno.json
{
  "imports": {
    "@actions/core": "npm:@actions/core@1.10.1",
    "@actions/github": "npm:@actions/github@6.0.0"
  }
}
// main.ts
import * as core from "@actions/core";
import * as github from "@actions/github";