Compare commits

..
Author SHA1 Message Date
Robby Russell b20d95c390 fix(gh): preserve valid completion cache on failure 2026-09-26 19:00:22 -05:00
3 changed files with 11 additions and 3 deletions
+1 -1
View File
@@ -60,6 +60,6 @@ jobs:
retention-days: 5
- name: "Upload to code-scanning"
uses: github/codeql-action/upload-sarif@2892aa5e19bbd11bc0cff5427e3b750a04d9e3c2 # v4.38.2
uses: github/codeql-action/upload-sarif@b96794f015dfd88f77b49b1c93e0fa7110f94c63 # v4.38.0
with:
sarif_file: results.sarif
+2
View File
@@ -18,3 +18,5 @@ plugin is loaded, which is usually when you start up a new terminal emulator.
The cache is stored at:
- `$ZSH_CACHE_DIR/completions/_gh` completions script
If an update fails, the last successfully generated completion script is kept.
+8 -2
View File
@@ -13,6 +13,12 @@ fi
zmodload -F zsh/files b:zf_mv
() {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_gh"
zf_mv -f -- =( gh completion --shell zsh ) "$TMPPREFIX"
local completion_file="$ZSH_CACHE_DIR/completions/_gh"
local completion_tmp="${completion_file}.$$.${RANDOM}"
if gh completion --shell zsh >| "$completion_tmp" && [[ -s "$completion_tmp" ]]; then
zf_mv -f -- "$completion_tmp" "$completion_file"
fi
command rm -f -- "$completion_tmp"
} &|