Skip to content

marcopinder/skills-write-javascript-actions

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Write JavaScript Actions

Write your own GitHub JavaScript Action and automate customized tasks unique to your workflow.

Step 3: Create the metadata file

Nice work configuring your action 😄

Action metadata

Every GitHub Action that we write needs to be accompanied by a metadata file. This file has a few rules to it, as are indicated below:

  • Filename must be action.yml.
  • Required for both Docker container and JavaScript actions.
  • Written in YAML syntax.

This file defines the following information about your action:

Parameter Description Required
Name The name of your action. Helps visually identify the actions in a job.
Description A summary of what your action does.
Inputs Input parameters allow you to specify data that the action expects to use during runtime. These parameters become environment variables in the runner.
Outputs Specifies the data that subsequent actions can use later in the workflow after the action that defines these outputs has run.
Runs The command to run when the action executes.
Branding You can use a color and Feather icon to create a badge to personalize and distinguish your action in GitHub Marketplace.

Read more about Action metadata

⌨️ Activity 1: Create the metadata file

All of the following steps take place inside of the .github/actions/joke-action directory.

Our action does not require much metadata for it to run correctly. We will not be accepting any inputs, we will however be setting a single output this time.

  1. Update the action metadata file .github/actions/joke-action/action.yml with the following content:

    name: "my joke action"
    
    description: "use an external API to retrieve and display a joke"
    
    outputs:
      joke-output:
        description: The resulting joke from the icanhazdadjokes API
    
    runs:
      using: "node16"
      main: "main.js"
  2. Save the action.yml file

  3. Commit the changes and push them to GitHub:

    git add action.yml
    git commit -m 'add metadata for the joke action'
    git pull
    git push
  4. Wait about 20 seconds then refresh this page (the one you're following instructions from). GitHub Actions will automatically update to the next step.


Get help: Post in our discussion boardReview the GitHub status page

© 2023 GitHub • Code of ConductMIT License

About

My clone repository

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published