Skip to content
Latchkey

gh issue create: Usage, Options & Common CI Errors

Open a GitHub issue from the command line - including from CI.

gh issue create opens a new issue. Interactively it prompts; in CI you pass title, body, labels, and assignees as flags so it runs unattended - handy for filing automated reports.

What it does

gh issue create files an issue in the repository with a title and body, optionally setting labels, assignees, milestone, and project. --body-file reads the body from a file (or - for stdin), which is the clean way to pass multi-line content in CI.

Common usage

Terminal
# Interactive
gh issue create

# Non-interactive (CI): title, body, label, assignee
gh issue create --title "Nightly build failed" \
  --body "See run logs" --label ci,bug --assignee "@me"

# Body from a file (or stdin with -)
gh issue create --title "Report" --body-file report.md

Common error in CI: prompts for title / label not found

gh issue create hangs prompting for a title in a non-TTY, or fails with "could not add label: \"bug\" not found" when the label does not exist in the repo. Fix: always pass --title and --body/--body-file in CI, and create labels first (gh label create bug) or use only existing ones. Issues must be enabled on the repo, and GH_TOKEN needs repo scope (issues: write permission in Actions).

Key options

OptionPurpose
-t, --titleIssue title
-b, --bodyIssue body (or --body-file)
-l, --labelLabels to apply
-a, --assigneeAssignees (@me for yourself)
-m, --milestoneMilestone to add it to

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →