#14528·cli

[Design] `gh issue artifact download`

Author: BagToadCreated Sep 25, 2026Updated Sep 28, 2026
Labelsenhancementgh-issue

gh issue artifact download

Table of Contents

help

Category Scenario
Help download

gh issue artifact download

Category Scenario
Downloading All artifacts
Downloading Selected artifacts
Downloading By URL
Downloading Unusual names
Downloading With --dir
Existing files A file already exists
Existing files With --skip-existing
Existing files With --clobber
Existing files Symlinked target
Single artifact With --output <file>
Single artifact With --output -
Single artifact With --version
Errors Error: --output with several artifacts
Errors Error: --version without one artifact
Errors Error: --clobber with --skip-existing
Errors Error: --dir with --output
Errors Error: no artifacts
Scripting Piped output
Scripting Piped output with existing files

help

What is changing
  • Help: Help for gh issue artifact download

download

Input:

bash
$ gh issue artifact download --help

Output:

Source & reproduction
bash
printf 'Download issue artifacts to files. Without artifact numbers, every artifact
on the issue is downloaded. Artifacts can also be named by their URLs, which
must all be on one issue. `<issue>` is an issue number or URL.

Each file is named `<number>-<name>`. Documents end in `.md`, and links are
saved as `.url` Internet Shortcut files. If a file already exists, that
artifact fails unless you use `--clobber` to overwrite it or `--skip-existing`
to skip it.

Use `--output` to choose the path for a single artifact, or `--output -` to
print its content. Use `--version` with a single artifact to download an
earlier version from its edit history.


\033[0;1;39mUSAGE\033[0m
  gh issue artifact download {<issue> [<artifact-number>...] | <artifact-url>...} [flags]

\033[0;1;39mFLAGS\033[0m
      --clobber          Overwrite existing files of the same name
  -D, --dir directory    The directory to download files into (default ".")
  -O, --output file      The file to write a single artifact to (use "-" to write to standard output)
      --skip-existing    Skip downloading when files of the same name exist
      --version number   Download the version with this number from the edit history

\033[0;1;39mINHERITED FLAGS\033[0m
      --help                     Show help for command
  -R, --repo [HOST/]OWNER/REPO   Select another repository using the [HOST/]OWNER/REPO format

\033[0;1;39mEXAMPLES\033[0m
  # Download every artifact on issue 142
  $ gh issue artifact download 142

  # Download two artifacts into a folder
  $ gh issue artifact download 142 2 5 --dir notes

  # Print one artifact'\''s content
  $ gh issue artifact download 142 2 --output -

  # Download an earlier version of one artifact
  $ gh issue artifact download 142 2 --version 5

\033[0;1;39mLEARN MORE\033[0m
  Use `gh <command> <subcommand> --help` for more information about a command.
  Read the manual at https://cli.github.com/manual
  Learn about exit codes using `gh help exit-codes`
  Learn about accessibility experiences using `gh help accessibility`
' > help-download.ans
freeze help-download.ans --output help-download.png --language ansi --font.family 'JetBrains Mono,SF Mono,Menlo,monospace' --font.size 12 --line-height 1.4 --window --padding '20,40,20,20' --background '#2b3037' --margin 20 --shadow.blur 6 --border.radius 8 --width 1560

gh issue artifact download

What is changing
  • Downloading: Download every artifact on the issue into the current directory
  • Downloading: Download only the given artifact numbers
  • Downloading: Artifact URLs can replace the issue and numbers
  • Downloading: Spaces become -, a name that already ends in .md isn't given a second one, and the number prefix keeps Windows device names like CON safe
  • Downloading: Download into another directory with --dir
  • Existing files: Existing files are not overwritten; the others are still written, and the command exits 1
  • Existing files: --skip-existing leaves existing files alone and is not a failure
  • Existing files: --clobber overwrites existing files
  • Existing files: gh never writes through a symlink, even with --clobber
  • Single artifact: --output writes one artifact to a chosen path
  • Single artifact: --output - writes only the body to standard output, with no status line
  • Single artifact: --version writes an earlier version, named by the usual rule from that version's name
  • Errors: --output needs exactly one artifact number
  • Errors: --version needs exactly one artifact number
  • Errors: --clobber and --skip-existing are mutually exclusive
  • Errors: --dir and --output are mutually exclusive
  • Errors: An issue with no artifacts fails, like the other download commands
  • Scripting: When piped, each artifact gets a <status>\t<number>\t<path>\t<source>\t<reason> line on stdout, with an empty source
  • Scripting: When piped, skipped and failed files are lines on stdout too, and any failure exits 1

All artifacts

Input:

bash
$ gh issue artifact download 142

Output:

Source & reproduction
bash
printf '\033[0;32m✓\033[0m {{file_name:2-OAuth-callback-plan.md}}
\033[0;32m✓\033[0m {{file_name:3-Staging-OAuth-runbook.url}}
\033[0;32m✓\033[0m {{file_name:5-Barista-feedback-notes.md}}
' > download-all.ans
freeze download-all.ans --output download-all.png --language ansi --font.family 'JetBrains Mono,SF Mono,Menlo,monospace' --font.size 12 --line-height 1.4 --window --padding '20,40,20,20' --background '#2b3037' --margin 20 --shadow.blur 6 --border.radius 8 --width 1360
Expected effects

Selected artifacts

Input:

bash
$ gh issue artifact download 142 2 5

Output:

Source & reproduction
bash
printf '\033[0;32m✓\033[0m {{file_name:2-OAuth-callback-plan.md}}
\033[0;32m✓\033[0m {{file_name:5-Barista-feedback-notes.md}}
' > download-selected.ans
freeze download-selected.ans --output download-selected.png --language ansi --font.family 'JetBrains Mono,SF Mono,Menlo,monospace' --font.size 12 --line-height 1.4 --window --padding '20,40,20,20' --background '#2b3037' --margin 20 --shadow.blur 6 --border.radius 8 --width 1360

By URL

Input:

bash
$ gh issue artifact download https://github.com/monalisa/monas-cafe/issues/142/artifacts/2 https://github.com/monalisa/monas-cafe/issues/142/artifacts/5

Output:

Source & reproduction
bash
printf '\033[0;32m✓\033[0m {{file_name:2-OAuth-callback-plan.md}}
\033[0;32m✓\033[0m {{file_name:5-Barista-feedback-notes.md}}
' > download-by-url.ans
freeze download-by-url.ans --output download-by-url.png --language ansi --font.family 'JetBrains Mono,SF Mono,Menlo,monospace' --font.size 12 --line-height 1.4 --window --padding '20,40,20,20' --background '#2b3037' --margin 20 --shadow.blur 6 --border.radius 8 --width 1360

Unusual names

Input:

bash
$ gh issue artifact download 145

Output:

Source & reproduction
bash
printf '\033[0;32m✓\033[0m {{file_name:1-My-implementation-plan.md}}
\033[0;32m✓\033[0m {{file_name:2-README.md}}
\033[0;32m✓\033[0m {{file_name:3-CON.md}}
\033[0;32m✓\033[0m {{file_name:4-日本語メモ.md}}
' > download-unusual-names.ans
freeze download-unusual-names.ans --output download-unusual-names.png --language ansi --font.family 'JetBrains Mono,SF Mono,Menlo,monospace' --font.size 12 --line-height 1.4 --window --padding '20,40,20,20' --background '#2b3037' --margin 20 --shadow.blur 6 --border.radius 8 --width 1360
Expected effects
  • All four files are written directly in the current directory, and nothing is written elsewhere

With --dir

Input:

bash
$ gh issue artifact download 142 --dir artifacts

Output:

Source & reproduction
bash
printf '\033[0;32m✓\033[0m {{file_name:artifacts/2-OAuth-callback-plan.md}}
\033[0;32m✓\033[0m {{file_name:artifacts/3-Staging-OAuth-runbook.url}}
\033[0;32m✓\033[0m {{file_name:artifacts/5-Barista-feedback-notes.md}}
' > download-into-dir.ans
freeze download-into-dir.ans --output download-into-dir.png --language ansi --font.family 'JetBrains Mono,SF Mono,Menlo,monospace' --font.size 12 --line-height 1.4 --window --padding '20,40,20,20' --background '#2b3037' --margin 20 --shadow.blur 6 --border.radius 8 --width 1360
Expected effects
  • The artifacts directory is created if it does not exist

A file already exists

Input:

bash
$ gh issue artifact download 142

Output:

Source & reproduction
bash
printf '\033[0;31mX\033[0m Failed to write {{file_name:2-OAuth-callback-plan.md}}: already exists (use --clobber to overwrite or --skip-existing to skip)
\033[0;32m✓\033[0m {{file_name:3-Staging-OAuth-runbook.url}}
\033[0;32m✓\033[0m {{file_name:5-Barista-feedback-notes.md}}
' > download-existing-file.ans
freeze download-existing-file.ans --output download-existing-file.png --language ansi --font.family 'JetBrains Mono,SF Mono,Menlo,monospace' --font.size 12 --line-height 1.4 --window --padding '20,40,20,20' --background '#2b3037' --margin 20 --shadow.blur 6 --border.radius 8 --width 1360
Expected effects
  • The existing 2-OAuth-callback-plan.md is unchanged

With --skip-existing

Input:

bash
$ gh issue artifact download 142 --skip-existing

Output:

Source & reproduction
bash
printf '\033[38;5;242m-\033[0m Skipped {{file_name:2-OAuth-callback-plan.md}}: already exists
\033[0;32m✓\033[0m {{file_name:3-Staging-OAuth-runbook.url}}
\033[0;32m✓\033[0m {{file_name:5-Barista-feedback-notes.md}}
' > download-skip-existing.ans
freeze download-skip-existing.ans --output download-skip-existing.png --language ansi --font.family 'JetBrains Mono,SF Mono,Menlo,monospace' --font.size 12 --line-height 1.4 --window --padding '20,40,20,20' --background '#2b3037' --margin 20 --shadow.blur 6 --border.radius 8 --width 1360

With --clobber

Input:

bash
$ gh issue artifact download 142 --clobber

Output:

Source & reproduction
bash
printf '\033[0;32m✓\033[0m {{file_name:2-OAuth-callback-plan.md}}
\033[0;32m✓\033[0m {{file_name:3-Staging-OAuth-runbook.url}}
\033[0;32m✓\033[0m {{file_name:5-Barista-feedback-notes.md}}
' > download-clobber.ans
freeze download-clobber.ans --output download-clobber.png --language ansi --font.family 'JetBrains Mono,SF Mono,Menlo,monospace' --font.size 12 --line-height 1.4 --window --padding '20,40,20,20' --background '#2b3037' --margin 20 --shadow.blur 6 --border.radius 8 --width 1360
Expected effects
  • 2-OAuth-callback-plan.md now holds the artifact's current body

Symlinked target

Input:

bash
$ printf 'keep\n' > other.md && ln -s other.md 2-OAuth-callback-plan.md

Input:

bash
$ gh issue artifact download 142 --clobber

Output:

Source & reproduction
bash
printf '\033[0;31mX\033[0m Failed to write {{file_name:2-OAuth-callback-plan.md}}: is a symlink
\033[0;32m✓\033[0m {{file_name:3-Staging-OAuth-runbook.url}}
\033[0;32m✓\033[0m {{file_name:5-Barista-feedback-notes.md}}
' > download-symlink-target.ans
freeze download-symlink-target.ans --output download-symlink-target.png --language ansi --font.family 'JetBrains Mono,SF Mono,Menlo,monospace' --font.size 12 --line-height 1.4 --window --padding '20,40,20,20' --background '#2b3037' --margin 20 --shadow.blur 6 --border.radius 8 --width 1360
Expected effects
  • The symlink and other.md are unchanged

With --output <file>

Input:

bash
$ gh issue artifact download 142 2 --output callback-plan.md

Output:

Source & reproduction
bash
printf '\033[0;32m✓\033[0m {{file_name:callback-plan.md}}
' > download-output-file.ans
freeze download-output-file.ans --output download-output-file.png --language ansi --font.family 'JetBrains Mono,SF Mono,Menlo,monospace' --font.size 12 --line-height 1.4 --window --padding '20,40,20,20' --background '#2b3037' --margin 20 --shadow.blur 6 --border.radius 8 --width 1360
Expected effects
  • callback-plan.md contains exactly artifact 2's body

With --output -

Input:

bash
$ gh issue artifact download 142 2 --output -

Output:

Source & reproduction
bash
printf '# {{heading:OAuth callback plan}}

{{body_text:1. Register the callback URL.}}
{{body_text:2. Wire up `order-history` sync.}}
' > download-output-stdout.ans
freeze download-output-stdout.ans --output download-output-stdout.png --language ansi --font.family 'JetBrains Mono,SF Mono,Menlo,monospace' --font.size 12 --line-height 1.4 --window --padding '20,40,20,20' --background '#2b3037' --margin 20 --shadow.blur 6 --border.radius 8 --width 1360

With --version

Input:

bash
$ gh issue artifact download 142 2 --version 5

Output:

Source & reproduction
bash
printf '\033[0;32m✓\033[0m {{file_name:2-OAuth-plan.md}}
' > download-version.ans
freeze download-version.ans --output download-version.png --language ansi --font.family 'JetBrains Mono,SF Mono,Menlo,monospace' --font.size 12 --line-height 1.4 --window --padding '20,40,20,20' --background '#2b3037' --margin 20 --shadow.blur 6 --border.radius 8 --width 1360
Expected effects
  • 2-OAuth-plan.md contains exactly the body of version 5 of artifact 2

Error: --output with several artifacts

Input:

bash
$ gh issue artifact download 142 2 5 --output callback-plan.md

Output:

Source & reproduction
bash
printf '--output requires exactly one artifact number
' > download-error-output-needs-one.ans
freeze download-error-output-needs-one.ans --output download-error-output-needs-one.png --language ansi --font.family 'JetBrains Mono,SF Mono,Menlo,monospace' --font.size 12 --line-height 1.4 --window --padding '20,40,20,20' --background '#2b3037' --margin 20 --shadow.blur 6 --border.radius 8 --width 1360

Error: --version without one artifact

Input:

bash
$ gh issue artifact download 142 --version 5

Output:

Source & reproduction
bash
printf '--version requires exactly one artifact number
' > download-error-version-needs-one.ans
freeze download-error-version-needs-one.ans --output download-error-version-needs-one.png --language ansi --font.family 'JetBrains Mono,SF Mono,Menlo,monospace' --font.size 12 --line-height 1.4 --window --padding '20,40,20,20' --background '#2b3037' --margin 20 --shadow.blur 6 --border.radius 8 --width 1360

Error: --clobber with --skip-existing

Input:

bash
$ gh issue artifact download 142 --clobber --skip-existing

Output:

Source & reproduction
bash
printf 'specify only one of `--clobber` or `--skip-existing`
' > download-error-clobber-and-skip.ans
freeze download-error-clobber-and-skip.ans --output download-error-clobber-and-skip.png --language ansi --font.family 'JetBrains Mono,SF Mono,Menlo,monospace' --font.size 12 --line-height 1.4 --window --padding '20,40,20,20' --background '#2b3037' --margin 20 --shadow.blur 6 --border.radius 8 --width 1360

Error: --dir with --output

Input:

bash
$ gh issue artifact download 142 2 --dir notes --output callback-plan.md

Output:

Source & reproduction
bash
printf 'specify only one of `--dir` or `--output`
' > download-error-dir-and-output.ans
freeze download-error-dir-and-output.ans --output download-error-dir-and-output.png --language ansi --font.family 'JetBrains Mono,SF Mono,Menlo,monospace' --font.size 12 --line-height 1.4 --window --padding '20,40,20,20' --background '#2b3037' --margin 20 --shadow.blur 6 --border.radius 8 --width 1360

<a id="download-error-no-arti