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
# 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.mdCommon 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
| Option | Purpose |
|---|---|
| -t, --title | Issue title |
| -b, --body | Issue body (or --body-file) |
| -l, --label | Labels to apply |
| -a, --assignee | Assignees (@me for yourself) |
| -m, --milestone | Milestone to add it to |