Fix Bump Go workflow: resolve cache conflicts and hardcoded repository reference#13
Fix Bump Go workflow: resolve cache conflicts and hardcoded repository reference#13
Conversation
Co-authored-by: darkangelpraha <183031713+darkangelpraha@users.noreply.github.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 70d34a077d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
|
||
| # ---- Check for existing PR -------------------------------------------------- | ||
| existing_pr=$(gh search prs --repo cli/cli --match title "$PR_TITLE" --json title --jq "map(select(.title == \"$PR_TITLE\") | .title) | length > 0") | ||
| existing_pr=$(gh search prs --repo "$GITHUB_REPOSITORY" --match title "$PR_TITLE" --json title --jq "map(select(.title == \"$PR_TITLE\") | .title) | length > 0") |
There was a problem hiding this comment.
Provide fallback when GITHUB_REPOSITORY is unset
Because the script runs with set -u, expanding "$GITHUB_REPOSITORY" here causes an immediate unbound variable failure when the script is executed outside GitHub Actions (for example, local dry-runs described in the script header). This commit makes local/manual execution regress from “works with a fixed repo” to “hard fail before PR lookup,” so the repo argument should use a safe default or derived fallback when GITHUB_REPOSITORY is missing.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Pull request overview
This PR aims to make the scheduled “Bump Go” automation more reliable and fork-friendly by avoiding Go cache restore failures and removing a hardcoded upstream repository reference.
Changes:
- Disable
actions/setup-go’s built-in caching for the bump workflow to avoid tar extraction/cache conflicts. - Update the bump script to search PRs in the current repository via
$GITHUB_REPOSITORYinstead ofcli/cli.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
.github/workflows/bump-go.yml |
Turns off setup-go caching for this workflow run. |
.github/workflows/scripts/bump-go.sh |
Uses $GITHUB_REPOSITORY for PR lookup to work in forks. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| @@ -16,6 +16,7 @@ jobs: | |||
| uses: actions/setup-go@v5 | |||
| with: | |||
| go-version-file: 'go.mod' | |||
There was a problem hiding this comment.
Disabling setup-go caching fixes the extraction issue, but it’s non-obvious in the workflow file itself. Add a short inline comment explaining the specific cache restore failure this avoids (and ideally a link to the relevant issue/run log) so future maintainers don’t re-enable it and reintroduce the problem.
| go-version-file: 'go.mod' | |
| go-version-file: 'go.mod' | |
| # Intentionally disable setup-go caching: restoring a cached Go toolchain caused CodeQL Go extraction to fail in this workflow. |
|
|
||
| # ---- Check for existing PR -------------------------------------------------- | ||
| existing_pr=$(gh search prs --repo cli/cli --match title "$PR_TITLE" --json title --jq "map(select(.title == \"$PR_TITLE\") | .title) | length > 0") | ||
| existing_pr=$(gh search prs --repo "$GITHUB_REPOSITORY" --match title "$PR_TITLE" --json title --jq "map(select(.title == \"$PR_TITLE\") | .title) | length > 0") |
There was a problem hiding this comment.
bump-go.sh is documented as runnable locally, but with set -u this change will cause an immediate error when GITHUB_REPOSITORY isn’t set (common outside GitHub Actions). Consider deriving the repo from gh repo view / git remote as a fallback, or explicitly validate GITHUB_REPOSITORY and update usage() to require it when not running in Actions.
The Bump Go workflow fails on tar extraction during cache restore and uses a hardcoded
cli/clirepository reference that breaks in forks.Changes
.github/workflows/bump-go.yml: Disable automatic Go caching to prevent tar extraction conflicts.github/workflows/scripts/bump-go.sh: Use dynamic repository referenceThe
cache: falseprevents setup-go from managing its own cache which was causing "File exists" errors. The$GITHUB_REPOSITORYvariable is automatically provided by GitHub Actions and resolves to the correct repository in any fork.Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
https://api.github.com/graphql/usr/bin/gh gh search prs --repo darkangelpraha/cli --match title Bump Go to 1.26.0 --json title --jq map(select(.title == "Bump Go to 1.26.0") | .title) | length > 0(http block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
This pull request was created from Copilot chat.
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.
Continue Tasks: ❌ 1 failed — View all