,

GitHub Copilot CLI

I encountered something interesting trying to use the old GitHub CLI + Copilot extension in my workflow yml file. Not knowing it deprecated in late 2025, I tried to use it and got the following error.

unknown command "copilot" for "gh"

Usage:  gh <command> <subcommand> [flags]

After doing some research, I discovered that it was depreciated and I should use GitHub Copilot CLI. (https://github.com/features/copilot/cli)

The correct way to call Copilot from my workflow yml file is the following.

# Call Copilot CLI
response=$(copilot -p "$copilot_prompt" --allow-tool shell 2>&1 || echo '{"should_notify":true,"title":"Copilot CLI Error","body":"Failed to get response from Copilot CLI"}')

Here is an explanation of the command above.

  • copilot: The base command for the GitHub Copilot CLI
  • -p: A flag used to provide a prompt directly from the cmd line instead of entering an interactive session.
  • --allow-tool shell: Grants Copilot permission to use the shell tool to execute commands, else you may be prompted for approval

Couple extra items I learned when trying to use GitHub Copilot CLI:

  • Install CLI from your workflow file with this command
  • You need an active paid GitHub Copilot subscription

Hello, Welcome to DevOpsUnleashed!

A blog dedicated to sharing information about DevOps. Here, you’ll find examples, tips, and tutorials on DevOps.

Feel free to share your experiences in the comments!

Blog Categories