Skip to main content
In this guide, you’ll learn how to:
  • Chain multiple shell commands in a single GitHub Actions step
  • Install and invoke a third-party CLI tool (cowsay) on the Ubuntu runner

Why Combine Commands in One Step?

By default, each run step in a job runs in its own shell session. This can lead to redundant setup and slower workflows. Using YAML’s pipe syntax (|) lets you:
  • Share the same shell environment
  • Reduce runner overhead
  • Improve readability
Every run step runs in a fresh shell. Use multi-line commands to keep related tasks together.

Separate run Steps Example

Single Multi-Line run Step

Executing a Third-Party CLI (cowsay)

Suppose you want to generate ASCII art using cowsay. Since it isn’t installed by default on the Ubuntu runner, invoking it directly will fail:
The image shows a GitHub Actions workflow interface with a job titled "first_job" that has failed. The steps include setting up the job, checking out the repository, listing and reading a file, generating ASCII artwork, and completing the job.
The error indicates that cowsay is not found.
Non-native tools must be installed before you can use them in your workflow.

Installing and Running cowsay

Add an installation step and then run the command:

Quick Reference Table

Watch Video