Commit 69bb15e
committed
Fail fast on missing env vars in
Without any guards the script trusted `PR_NUMBER` and the four
`NUMBER_OF_*` variables to be set. Missing ones expanded to empty
strings, so the script silently constructed paths like
`plans//fetched/...` and forwarded empty `-F threads=`, `-F comments=`
arguments. `gh` would then reject the call with a generic GraphQL
error instead of pointing at the missing variable, while the empty
directory had already been created.
Add `set -euo pipefail` and a `: "${VAR:?…}"` guard for each of the
five required variables, so the script aborts at the missing variable
with a clear "VAR is required" message before touching the filesystem
or talking to GitHub.
`LAST_CURSOR` is intentionally not guarded — it is the optional
incremental-fetch cursor and is referenced only through
`${LAST_CURSOR:+-F after="$LAST_CURSOR"}`, which is safe under `set -u`.
Addresses:
- #765 (comment)
Assisted-by: Claude Code:claude-opus-4-7fetch_reviews.sh
1 parent 090bc8a commit 69bb15e
1 file changed
Lines changed: 8 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
2 | 10 | | |
3 | 11 | | |
4 | 12 | | |
| |||
0 commit comments