Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -141,49 +141,4 @@ Here is an example of a badge for the Checkout action on the GitHub Marketplace.

:::image type="content" source="../media/actions-branding.png" alt-text="Screenshot that shows an action's branding on the GitHub Marketplace.":::

## Workflow commands

Creating a workflow is pretty straightforward as long as you can find the right actions for your steps. In some cases you may need to create your own actions to achieve your desired outcomes, but you can use workflow commands to add another level of customization to your workflows.

Workflow commands enable you to communicate with the GitHub Actions runner machine by printing formatted lines of text to the console. These workflow commands can be used with shell commands or within your custom actions. Workflow commands are useful because they enable you to share information between workflow steps, print debug or error messages to the console, set environment variables, set output parameters, or add to the system path.

Most workflow commands use the `echo` command in the below specific format, while others can be invoked by writing to a file.

```bash
echo "::workflow-command parameter1={data},parameter2={data}::{command value}"
```

Below are some basic message logging examples for printing a debug message, info message, error message, or warning message to the console.

```yml
- name: workflow commands logging messages
run: |
echo "::debug::This is a debug message"
echo "This is an info message"
echo "::error::This is an error message"
echo "::warning::This is a warning message"
```

You can also create a message to print to the log with a filename (file), line number (line), and column (col) number where the error occurred. Warning messages will appear in a yellow highlight with the text "warning", and error messages will appear in a red highlight with the text "error".

```bash
echo "::error file=app.js,line=10,col=15::Something went wrong"
```

It's important to note that these workflow commands need to be on a single line. Characters that interfere with parsing such as commas and line breaks will need to be URL-encoded.

For example, the below text is a multi-line message.

```yml
This text spans
across multiple lines
```

This message should be encoded as shown below.

```yml
This text spans%0Aacross multiple lines
```

In addition to workflow commands, you can set exit codes to set the status of an action. This is important because when you're working with jobs in a workflow, a failed exit code will halt all concurrent actions and cancel any future actions. If you are creating a JavaScript action, you can use the actions toolkit `@actions/core` package to log a message and set a failure exit code. If you are creating a Docker container action, you can set a failure exit code in your `entrypoint.sh` script.

We'll cover choosing the right visibility for your action, best practices for documenting and versioning your action, and how to publish your action to the GitHub Marketplace in the next unit.
4 changes: 2 additions & 2 deletions github/create-custom-github-actions/includes/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ This module assumes you have basic familiarity with GitHub Actions and workflows

- A GitHub account
- The ability to navigate and edit files in GitHub
- For more information about GitHub, see [Introduction to GitHub](https://lab.github.com/githubtraining/introduction-to-github?azure-portal=true).
- For more information about GitHub, see [Introduction to GitHub](https://docs.microsoft.com/en-us/learn/modules/introduction-to-github?azure-portal=true).
- Basic familiarity with GitHub Actions and workflows
- If you aren't familiar with workflows, jobs and steps, check out the [Automate development tasks by using GitHub Actions](/learn/modules/github-actions-automate-tasks/) module.
- Basic familiarity with continuous integration using GitHub Actions and workflows
- If you're unfamiliar with continuous integration using GitHub Actions and workflows, check out [Build continuous integration workflows by using GitHub Actions](/learn/modules/github-actions-ci/)
- If you're unfamiliar with continuous integration using GitHub Actions and workflows, check out [Build continuous integration workflows by using GitHub Actions](/learn/modules/github-actions-ci/)
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,12 @@ steps:
- uses: actions/javascript-action@2522385f6f7ba04fe7327647b213799853a8f55c
```

## Use dependency graph

The dependency graph helps you understand the software you depend on. Developers and maintainers can benefit from seeing who depends upon their actions. From any repository which uses Actions, you can see your Actions workflows listed alongside any other dependencies in the Insights/Dependency Graph experience. You can configure Dependabot version updates to keep your Actions dependencies up to date automatically.

Additionally, you can view a list of repositories that depend on your action under the Dependencies tab. Alternatively, you can look at the **Used By** count on your repository homepage. This count does not include any private repositories that might use your action.

## Publish an action to the GitHub Marketplace

:::image type="content" source="../media/marketplace.png" alt-text="Image that says GitHub Marketplace, tools to build on and improve your workflow." border="false":::
Expand Down