Skip to main content
Running a series of shell commands directly in a workflow can quickly become messy. By placing your commands in a standalone script file and invoking it in one step, you maintain a clean, maintainable workflow.

Table of Contents

1. Create the Shell Script

In your repository root, add a file named ascii-script.sh:
Commit and push this script.
Make sure your script uses a Unix-style line ending (LF) and the correct shebang (#!/bin/sh).

2. Example: Workflow Fails Due to Permissions

A minimal workflow that invokes the script directly will fail because the checked-out file isn’t executable by default:
When this runs, you’ll see:
Without executable permissions, the runner cannot invoke your script. Always ensure your scripts are marked as executable before running.

3. Grant Execute Permissions in Workflow

Update the workflow to add a chmod +x step before executing:
Commit and push these changes to trigger a new run.

4. Verify the Workflow Run

  1. Go to the Actions tab and select your latest workflow.
  2. In List Files Before Run, notice ascii-script.sh is still -rw-r--r--:
  3. The Make Script Executable and Run step applies chmod +x and executes the script. You’ll see:
  4. Finally, the script’s ls -ltra shows both the executable script and generated dragon.txt:
With executable permissions in place, your script will run smoothly—keeping your workflow concise and your commands centralized.

Watch Video