Metadata syntax for GitHub Actions

You can create actions to perform tasks in your repository. Actions require a metadata file that uses YAML syntax.

GitHub Actions is available with GitHub Free, GitHub Pro, GitHub Team, and GitHub Enterprise Cloud. GitHub Actions is unavailable for per-repository plans, which are legacy billing plans. For more information, see "GitHub's products."

In this article

About YAML syntax for GitHub Actions

Docker and JavaScript actions require a metadata file. The metadata filename must be action.yml. The data in the metadata file defines the inputs, outputs and main entrypoint for your action.

Action metadata files use YAML syntax. If you're new to YAML, you can read "Learn YAML in five minutes."

name

Required The name of your action. GitHub displays the name in the Actions tab to help visually identify actions in each job.

author

Optional The name of the action's author.

description

Required A short description of the action.

inputs

Optional Input parameters allow you to specify data that the action expects to use during runtime. GitHub stores input parameters as environment variables. Input ids with uppercase letters are converted to lowercase during runtime. We recommended using lowercase input ids.

Example

This example configures two inputs: numOctocats and octocatEyeColor. The numOctocats input is not required and will default to a value of '1'. The octocatEyeColor input is required and has no default value. Workflow files that use this action must use the with keyword to set an input value for octocatEyeColor. For more information about the with syntax, see "Workflow syntax for GitHub Actions."

inputs:
  numOctocats:
    description: 'Number of Octocats'
    required: false
    default: '1'
  octocatEyeColor:
    description: 'Eye color of the Octocats'
    required: true

When you specify an input to an action in a workflow file or use a default input value, GitHub creates an environment variable for the input with the name INPUT_<VARIABLE_NAME>. The environment variable created converts input names to uppercase letters and replaces spaces with _ characters.

For example, if a workflow defined the numOctocats and octocatEyeColor inputs, the action code could read the values of the inputs using the INPUT_NUMOCTOCATS and INPUT_OCTOCATEYECOLOR environment variables.

inputs.<input_id>

Required A string identifier to associate with the input. The value of <input_id> is a map of the input's metadata. The <input_id> must be a unique identifier within the inputs object. The <input_id> must start with a letter or _ and contain only alphanumeric characters, -, or _.

inputs.<input_id>.description

Required A string description of the input parameter.

inputs.<input_id>.required

Required A boolean to indicate whether the action requires the input parameter. Set to true when the parameter is required.

inputs.<input_id>.default

Optional A string representing the default value. The default value is used when an input parameter isn't specified in a workflow file.

outputs

Optional Output parameters allow you to specify the data that subsequent actions can use later in the workflow after the action that defines these outputs has run. For example, if you had an action that performed the addition of two inputs (x + y = z), the action could output the sum (z) for other actions to use as an input.

Output ids with uppercase letters are converted to lowercase during runtime. We recommended using lowercase output ids.

outputs.<output_id>

Required A string identifier to associate with the output. The value of <output_id> is a map of the output's metadata. The <output_id> must be a unique identifier within the outputs object. The <output_id> must start with a letter or _ and contain only alphanumeric characters, -, or _.

outputs.<output_id>.description

Required A string description of the output parameter.

runs

Required The command to run when the action executes.

using

Required The application to use to execute the code specified in main.

Example using Node.js
using: 'node12'
main: 'main.js'
Examples using Dockerfile in your repository
using: 'docker'
image: 'Dockerfile'
using: 'docker'
image: 'docker://debian:stetch-slim'

env

Optional Specifies a key/value map of environment variables to set in the virtual environment.

main

Required for JavaScript actions The code file that contains your action code. The application specified with the using syntax will execute this file.

image

Required for container actions The Docker image to use as the container to run the action. The value can be the Docker base image name, a local Dockerfile in your repository, a public docker Hub or registry. To reference a Dockerfile local to your repository, use a path relative to the root of the repository. The application specified with the using syntax will execute this file.

Example using Dockerfile in your repository
image: 'Dockerfile'
Example using public Docker registry container
image: 'docker://debian:stretch-slim'
Example using public Docker container on GitHub
image: 'actions/container-template@master'

entrypoint

Optional for container actions Overrides the Docker ENTRYPOINT in the Dockerfile, or sets it if one wasn't already specified. If an action does not use the runs keyword, the commands in entrypoint will execute. The Docker ENTRYPOINT instruction has a shell form and exec form. The Docker ENTRYPOINT documentation recommends using the exec form of the ENTRYPOINT instruction.

args

Optional for container actions An array of strings that define the inputs for a Docker container. Inputs can include hardcoded strings. GitHub passes the args to the container's ENTRYPOINT when the container starts up.

The args are used in place of the CMD instruction in a Dockerfile. If you use CMD in your Dockerfile, use the guidelines ordered by preference:

  1. Document required arguments in the action's README and omit them from the CMD instruction.
  2. Use defaults that allow using the action without specifying any args.
  3. If the action exposes a --help flag, or something similar, use that as the default to make your action self-documenting.
Example
# array format
args: ['${{ inputs.greeting }}', 'foo', 'bar']

# and because it's just YAML, this works:
args:
  - ${{ inputs.greeting }}
  - 'foo'
  - 'bar'

branding

You can use a color and Feather icon to create a badge to personalize and distinguish your action in GitHub Marketplace. For more information, see "GitHub Actions in the GitHub Marketplace" in the GitHub Developer documentation.

Example

branding:
  icon: 'award'  
  color: 'green'

color

The background color of the badge. Can be one of: white, yellow, blue, green, orange, red, purple, or gray-dark.

icon

The name of the Feather icon to use.

activity airplay alert-circle alert-octagon
alert-triangle align-center align-justify align-left
align-right anchor aperture archive
arrow-down-circle arrow-down-left arrow-down-right arrow-down
arrow-left-circle arrow-left arrow-right-circle arrow-right
arrow-up-circle arrow-up-left arrow-up-right arrow-up
at-sign award bar-chart-2 bar-chart
battery-charging battery bell-off bell
bluetooth bold book-open book
bookmark box briefcase calendar
camera-off camera cast check-circle
check-square check chevron-down chevron-left
chevron-right chevron-up chevrons-down chevrons-left
chevrons-right chevrons-up circle clipboard
clock cloud-drizzle cloud-lightning cloud-off
cloud-rain cloud-snow cloud code
command compass copy corner-down-left
corner-down-right corner-left-down corner-left-up corner-right-down
corner-right-up corner-up-left corner-up-right cpu
credit-card crop crosshair database
delete disc dollar-sign download-cloud
download droplet edit-2 edit-3
edit external-link eye-off eye
facebook fast-forward feather file-minus
file-plus file-text file film
filter flag folder-minus folder-plus
folder gift git-branch git-commit
git-merge git-pull-request globe grid
hard-drive hash headphones heart
help-circle home image inbox
info italic layers layout
life-buoy link-2 link list
loader lock log-in log-out
mail map-pin map maximize-2
maximize menu message-circle message-square
mic-off mic minimize-2 minimize
minus-circle minus-square minus monitor
moon more-horizontal more-vertical move
music navigation-2 navigation octagon
package paperclip pause-circle pause
percent phone-call phone-forwarded phone-incoming
phone-missed phone-off phone-outgoing phone
pie-chart play-circle play plus-circle
plus-square plus pocket power
printer radio refresh-ccw refresh-cw
repeat rewind rotate-ccw rotate-cw
rss save scissors search
send server settings share-2
share shield-off shield shopping-bag
shopping-cart shuffle sidebar skip-back
skip-forward slash sliders smartphone
speaker square star stop-circle
sun sunrise sunset tablet
tag target terminal thermometer
thumbs-down thumbs-up toggle-left toggle-right
trash-2 trash trending-down trending-up
triangle truck tv type
umbrella underline unlock upload-cloud
upload user-check user-minus user-plus
user-x user users video-off
video voicemail volume-1 volume-2
volume-x volume watch wifi-off
wifi wind x-circle x-square
x zap-off zap zoom-in
zoom-out

Ask a human

Can't find what you're looking for?

Contact us