---
title: "Scripting with GitHub CLI"
description: "GitHub CLI (`gh`) can be extended and scripted by combining it with standard Unix tools."
url: "https://swe.quest/articles/scripting-with-github-cli-91a3a551f29d6152"
canonical: "https://github.blog/engineering/engineering-principles/scripting-with-github-cli/"
source: "GitHub Engineering"
published: "2021-03-11"
difficulty: "medium"
kind: "How-to"
reading_minutes: 6
tags: ["developer-tools","ci-cd","api-design"]
---

# Scripting with GitHub CLI

A post on [GitHub Engineering](https://swe.quest/sources/github.md), published 2021-03-11, 6 min read, How-to. Original: [https://github.blog/engineering/engineering-principles/scripting-with-github-cli/](https://github.blog/engineering/engineering-principles/scripting-with-github-cli/)

## Summary

GitHub CLI (\`gh\`) can be extended and scripted by combining it with standard Unix tools. Aliases shorten common commands, PAGER settings route output through \`less\` or \`delta\`, and \`fzf\` plus \`cut\` turn \`gh pr list\` into an interactive PR checkout. When output is piped, \`gh\` emits tab-delimited, untruncated, uncolored text for scripts, and it comes pre-installed in GitHub Actions for tasks like enabling auto-merge or creating releases. \`gh api\` handles REST and GraphQL calls with auth, pagination, caching and built-in jq filtering, demonstrated by dynamically building a search for issues involving members of a team.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [Developer tools](https://swe.quest/tags/developer-tools.md) (Engineering practices)
- [CI/CD](https://swe.quest/tags/ci-cd.md) (Reliability & operations)
- [API design](https://swe.quest/tags/api-design.md) (Backend & APIs)

## Prerequisites

- Unix shell basics
- GitHub pull requests and issues
- jq syntax

## Keywords

GitHub CLI, GitHub Actions, fzf, jq, delta, GitHub API

## Related posts

- [Migration Automation: Easing the Jenkins → GHA shift with help from AI](https://swe.quest/articles/migration-automation-easing-the-jenkins-gha-shift-with-help-from-ai-33309f9411d86fc7.md): Slack Engineering · 2024-12-16 · Medium · 13 min read · CI/CD, AI for coding, Refactoring & migrations, LLMs
  Slack built a conversion tool to move 242 Jenkins pipelines to GitHub Actions by layering corrections on top of GitHub's Actions Importer, which fully converted about 50% of pipelines, partially converted 45% and failed on 5%.
- [How the GitHub CLI can now enable triangular workflows](https://swe.quest/articles/how-the-github-cli-can-now-enable-triangular-workflows-9d168cb0f33f735d.md): GitHub Engineering · 2025-04-25 · Medium · 10 min read · Version control, Developer tools
  GitHub CLI v2.71.2 makes \`gh pr\` commands resolve a branch's push and pull targets the same way Git does, so triangular workflows work.
- [How AI Assistants Can Decode GitHub Repos for UI Writers](https://swe.quest/articles/how-ai-assistants-can-decode-github-repos-for-ui-writers-bed232efc1e6b9e6.md): Docker · 2024-12-16 · Medium · 9 min read · AI agents, LLMs, Code review, Frontend
  An LLM agent can reliably flag user-facing copy changes in a branch when it is given narrow tools and expert hints about what "user-facing" means.
- [How to Build GitHub Copilot Extensions](https://swe.quest/articles/how-to-build-github-copilot-extensions-be22dc85804ae8a3.md): Neon · 2025-02-06 · Medium · 5 min read · AI for coding, AI agents, Python, Developer tools
  GitHub Copilot extensions are plain HTTP servers that GitHub calls whenever a user mentions the extension in Copilot Chat, so they can be written in any language.
- [Continuous AI for accessibility: How GitHub transforms feedback into inclusion](https://swe.quest/articles/continuous-ai-for-accessibility-how-github-transforms-feedback-into-inclusion-c36ff177f3a2d142.md): GitHub Engineering · 2026-03-12 · Medium · 14 min read · Accessibility, AI agents, LLMs, CI/CD
  GitHub built an event-driven accessibility feedback pipeline on GitHub Actions, Copilot and the GitHub Models API that turns every user report into a tracked, prioritized issue.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
