gh cache list
列出 GitHub Actions 缓存
gh cache list [flags]
选项
-q,--jq <表达式>- 使用 jq 表达式过滤 JSON 输出
-
--json <字段> - 使用指定的字段输出 JSON
-k,--key <字符串>- 按缓存键前缀过滤
-L,--limit <int> (默认值 30)- 要获取的最大缓存数量
-O,--order <字符串> (默认值 "desc")- 返回的缓存顺序:{asc|desc}
-r,--ref <字符串>- 按 ref 过滤,格式为 refs/heads/<分支名称> 或 refs/pull/<数字>/merge
-S,--sort <字符串> (默认值 "last_accessed_at")- 对获取的缓存进行排序:{created_at|last_accessed_at|size_in_bytes}
-t,--template <字符串>- 使用 Go 模板格式化 JSON 输出;请参阅“gh help formatting”
从父命令继承的选项
-R,--repo <[HOST/]OWNER/REPO>- 使用 [HOST/]OWNER/REPO 格式选择另一个仓库
别名
gh cache ls
JSON 字段
createdAt, id, key, lastAccessedAt, ref, sizeInBytes, version
示例
# List caches for current repository
$ gh cache list
# List caches for specific repository
$ gh cache list --repo cli/cli
# List caches sorted by least recently accessed
$ gh cache list --sort last_accessed_at --order asc
# List caches that have keys matching a prefix (or that match exactly)
$ gh cache list --key key-prefix
# To list caches for a specific branch, replace <branch-name> with the actual branch name
$ gh cache list --ref refs/heads/<branch-name>
# To list caches for a specific pull request, replace <pr-number> with the actual pull request number
$ gh cache list --ref refs/pull/<pr-number>/merge