Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
c219743
Add acceptance coverage for gist
williammartin Aug 7, 2026
bceaa3b
Wait longer for the search index in the issues script
williammartin Aug 7, 2026
0f3ab22
Let GH_ACCEPTANCE_SCRIPT name several scripts
williammartin Aug 7, 2026
eae00d0
Add the api_host gateway harness
williammartin Aug 7, 2026
3189464
Send a host's token to its configured api_host
williammartin Aug 7, 2026
2d89b26
Make gh api honour api_host for relative paths
williammartin Aug 7, 2026
670b2a3
Send RenameRepo to a relative path
williammartin Aug 7, 2026
62a6e9e
Add a raw response request surface to api.Client
williammartin Aug 7, 2026
216199e
Let a caller name the scopes an endpoint needs
williammartin Aug 7, 2026
eae1deb
Let a caller stop a request following redirects
williammartin Aug 7, 2026
6fcf2ea
Let callers set headers on a shared client request
williammartin Aug 7, 2026
ffb187b
Send release asset uploads and downloads through api.Client
williammartin Aug 7, 2026
97fcb73
docs(api): clarify redirect method-rewriting in comments
babakks Aug 27, 2026
dbbaed8
fix(config): resolve api_host collisions deterministically
babakks Aug 27, 2026
fbda842
refactor(api): use errors.AsType for HTTP error checks
babakks Aug 27, 2026
d5ff05b
test(acceptance): cover selecting multiple scripts in one directory
babakks Aug 27, 2026
c67d0e6
test(api): assert DoRequest preserves an explicit ContentLength
babakks Aug 27, 2026
2266020
test(config): cover deterministic api_host collision resolution
babakks Aug 27, 2026
62f5a7c
test(config): add coverage for APIHostForHost
babakks Aug 27, 2026
061b2a1
fix(auth/shared): route GetScopes path through safeurl
babakks Aug 27, 2026
fcd05d9
chore(codeql): cover api.Client.Request in SafeURL path query
babakks Aug 27, 2026
4288f57
build(deps): bump go-gh to per-host api_host branch
babakks Aug 27, 2026
95107ff
test(acceptance): fix scriptfilter table field alignment
babakks Aug 27, 2026
48922ac
fix(api): compare request hostname without port when attaching auth t…
babakks Aug 28, 2026
ee5ed71
chore: tidy go.sum
babakks Aug 28, 2026
e7675c9
test(internal/attachments): add new method required by interface
babakks Aug 28, 2026
061e585
chore: apply go fix
babakks Aug 28, 2026
2f88d05
refactor(attachments): send uploads through api.Client.DoRequest
babakks Aug 28, 2026
6656e47
build(deps): bump go-gh to rebased per-host api_host branch
babakks Aug 28, 2026
fe76ff5
Rename tokenGetter to config
williammartin Sep 2, 2026
628e85c
Refactor AddAuthTokenHeader
williammartin Sep 2, 2026
714e5ea
Document when telemetry disabling is overzealous
williammartin Sep 2, 2026
8b3e2f1
Comment missing api-client-rollout todo
williammartin Sep 2, 2026
5ba76c6
Comment api command api_host usage
williammartin Sep 2, 2026
6e7b1fe
Remove redundant comment in gist create
williammartin Sep 2, 2026
0580da9
Remove unnecessary 204 on release edit
williammartin Sep 2, 2026
05a0a02
Remove redundant searcher comment
williammartin Sep 2, 2026
6865464
Bump go-gh to v2.15.0
williammartin Sep 2, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Add acceptance coverage for gist
gist had no acceptance scripts, so its commands were never exercised
against a real host. Cover create, view and delete in one script, and
edit, rename and list in another.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
  • Loading branch information
williammartin and Copilot committed Sep 2, 2026
commit c219743b2ea557ac6de01aaa8bd03dca59a19c4e
9 changes: 9 additions & 0 deletions acceptance/acceptance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,15 @@ func TestAuth(t *testing.T) {
testscript.Run(t, testScriptParamsFor(tsEnv, "auth"))
}

func TestGists(t *testing.T) {
var tsEnv testScriptEnv
if err := tsEnv.fromEnv(); err != nil {
t.Fatal(err)
}

testscript.Run(t, testScriptParamsFor(tsEnv, "gist"))
}

func TestGPGKeys(t *testing.T) {
var tsEnv testScriptEnv
if err := tsEnv.fromEnv(); err != nil {
Expand Down
40 changes: 40 additions & 0 deletions acceptance/testdata/gist/gist-create-view-delete.txtar
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Gists are owned by the authenticated user rather than an org, so unlike most
# other acceptance scripts there is no repository to create or clean up.
#
# Not covered here: gists whose files exceed the API's 1MB inline limit come
# back truncated, and the full content is then fetched from a raw URL on
# gist.githubusercontent.com rather than the API host. Triggering that needs a
# file too large to keep in a txtar, so it is left to unit tests.

# Setup useful env vars
env GIST_DESC=${SCRIPT_NAME}-${RANDOM_STRING}

# Create a gist from a file, capturing its URL
exec gh gist create gist-file.txt --desc ${GIST_DESC}
stdout 'https://gist.github.com/'
stdout2env GIST_URL

# View the gist and check the description and content are both rendered
exec gh gist view ${GIST_URL}
stdout ${GIST_DESC}
stdout 'hello from the acceptance tests'

# List the file names in the gist
exec gh gist view ${GIST_URL} --files
stdout 'gist-file.txt'

# View a single file raw, which must be the content we uploaded and nothing else
exec gh gist view ${GIST_URL} --filename gist-file.txt --raw
stdout 'hello from the acceptance tests'
! stdout ${GIST_DESC}

# Delete the gist. This is deliberately not deferred because deletion is what
# the script is testing, and a deferred delete would fail on the second attempt.
exec gh gist delete --yes ${GIST_URL}

# Check the gist is gone
! exec gh gist view ${GIST_URL}
stderr 'not found'

-- gist-file.txt --
hello from the acceptance tests
60 changes: 60 additions & 0 deletions acceptance/testdata/gist/gist-edit-rename-list.txtar
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# Gists are owned by the authenticated user rather than an org, so unlike most
# other acceptance scripts there is no repository to create or clean up.
#
# Only --add is exercised here. Editing a file's content, and editing the
# description on its own, both fall through to an interactive editor, so they
# cannot be driven from a script. --remove is left out deliberately, because it
# issues the same update request as --add and so covers no further ground.
#
# Every update to an existing gist is followed by a sleep. A read that comes
# straight after an update serves the previous state around twice in ten
# attempts, and it settles within about a second and a half. The sleeps matter
# most before the next gh command rather than before an assertion: rename reads
# the gist to build its update, so a stale read there renames nothing at all and
# still exits 0, leaving the gist permanently wrong rather than briefly behind.
# Creating a gist reads back consistently, so it needs no sleep.

# Setup useful env vars
env GIST_DESC=${SCRIPT_NAME}-${RANDOM_STRING}

# Create a gist from a file, capturing its URL
exec gh gist create first.txt --desc ${GIST_DESC}
stdout2env GIST_URL

# Defer gist cleanup
defer gh gist delete --yes ${GIST_URL}

# Add a second file to the gist
exec gh gist edit ${GIST_URL} --add second.txt
sleep 5

# Check both files are now in the gist
exec gh gist view ${GIST_URL} --files
stdout 'first.txt'
stdout 'second.txt'

# Rename the second file. Checking that the new name is present is enough to
# prove the rename happened, and asserting the absence of the old name would
# only add another chance to read the gist before the write has settled.
exec gh gist rename ${GIST_URL} second.txt renamed.txt
sleep 5

# Check the rename took effect
exec gh gist view ${GIST_URL} --files
stdout 'first.txt'
stdout 'renamed.txt'

# Check the renamed file kept its content
exec gh gist view ${GIST_URL} --filename renamed.txt --raw
stdout 'the second file'

# Find the gist by description, which lists secret gists by default
exec gh gist list --filter ${GIST_DESC}
stdout ${GIST_DESC}
stdout '2 files'
stdout 'secret'

-- first.txt --
the first file
-- second.txt --
the second file