Add early check for gh default repo in gh wrapper scripts#243
Conversation
Added a check to `executable_gh-release.sh` and `executable_gh-pr.sh` using `gh repo set-default --view` to ensure a default remote repository is configured before performing any git operations like creating tags or branches. This prevents scripts from failing midway when `gh` commands require a default repository context.
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
| exit 1 | ||
| fi | ||
|
|
||
| if ! gh repo set-default --view > /dev/null 2>&1; then |
There was a problem hiding this comment.
Yes! The gh repo set-default --view command only fails (returns a non-zero exit code) if a default repository hasn't been set yet. If one is already set, it successfully views it and returns 0, so the if block is skipped and the script continues.
| set -eux | ||
|
|
||
| if ! gh repo set-default --view > /dev/null 2>&1; then | ||
| echo "X No default remote repository has been set." >&2 |
There was a problem hiding this comment.
Yes! The gh repo set-default --view command only fails (returns a non-zero exit code) if a default repository hasn't been set yet. If one is already set, it successfully views it and returns 0, so the if block is skipped and the script continues.
Added a check to `executable_gh-release.sh` and `executable_gh-pr.sh` using `gh repo set-default --view` to ensure a default remote repository is configured before performing any git operations like creating tags or branches. This prevents scripts from failing midway when `gh` commands require a default repository context.
Added early exit conditions to
executable_gh-release.shandexecutable_gh-pr.shif the GitHub CLI does not have a default repository configured (gh repo set-default). This catches the error before the script attempts to make modifications to the git repository (such as creating and pushing tags or branches), addressing the user's request. Tested viashellcheck.PR created automatically by Jules for task 9894805141929727994 started by @arran4