Skip to content

Fix Bump Go workflow: resolve cache conflicts and hardcoded repository reference#13

Open
Copilot wants to merge 2 commits intotrunkfrom
copilot/fix-bump-go-workflow-errors
Open

Fix Bump Go workflow: resolve cache conflicts and hardcoded repository reference#13
Copilot wants to merge 2 commits intotrunkfrom
copilot/fix-bump-go-workflow-errors

Conversation

Copy link

Copilot AI commented Feb 14, 2026

The Bump Go workflow fails on tar extraction during cache restore and uses a hardcoded cli/cli repository reference that breaks in forks.

Changes

  • .github/workflows/bump-go.yml: Disable automatic Go caching to prevent tar extraction conflicts

    - name: Set up Go
      uses: actions/setup-go@v5
      with:
        go-version-file: 'go.mod'
        cache: false  # Added
  • .github/workflows/scripts/bump-go.sh: Use dynamic repository reference

    # Line 93: Changed from hardcoded to environment variable
    existing_pr=$(gh search prs --repo "$GITHUB_REPOSITORY" --match title "$PR_TITLE" ...)

The cache: false prevents setup-go from managing its own cache which was causing "File exists" errors. The $GITHUB_REPOSITORY variable 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
    • Triggering command: /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

Problem

The Bump Go workflow is failing with multiple issues:

  1. Tar extraction errors during cache restore: The actions/setup-go@v5 action is experiencing "File exists" errors when trying to restore the Go cache
  2. Repository rule violations: The script tries to push directly to bump-go-1.26.0 branch but is rejected with "GH013: Repository rule violations found"
  3. Wrong repository reference: Line 93 in .github/workflows/scripts/bump-go.sh references cli/cli but should use the correct repository $GITHUB_REPOSITORY or darkangelpraha/cli
  4. Submodule error: Git submodule cleanup fails for canva-connect-api-starter-kit with missing URL in .gitmodules

Solution Required

1. Fix the workflow file (.github/workflows/bump-go.yml)

Add cache cleanup and handle the tar extraction issue:

  • Add cache: false to the actions/setup-go@v5 step to disable automatic caching which is causing conflicts
  • Ensure the checkout action properly handles submodules

2. Fix the bump-go.sh script (.github/workflows/scripts/bump-go.sh)

Line 93 needs to use the dynamic repository instead of hardcoded cli/cli:

# Current (incorrect):
existing_pr=$(gh search prs --repo cli/cli --match title "$PR_TITLE" --json title --jq "map(select(.title == \"$PR_TITLE\") | .title) | length > 0")

# Should be (using environment variable):
existing_pr=$(gh search prs --repo "$GITHUB_REPOSITORY" --match title "$PR_TITLE" --json title --jq "map(select(.title == \"$PR_TITLE\") | .title) | length > 0")

3. Repository rules compliance

The workflow should create a PR rather than pushing directly. The script already does this (lines 121-123), so the issue is that it's attempting to push to a protected branch. Ensure the branch name doesn't trigger branch protection rules, or modify the script to use a different approach that complies with the rules.

Files to Update

  1. .github/workflows/bump-go.yml - Add cache: false to setup-go step
  2. .github/workflows/scripts/bump-go.sh - Fix line 93 to use $GITHUB_REPOSITORY

Expected Outcome

  • Cache restoration works without tar errors
  • PR search correctly checks the right repository
  • Branch push succeeds and PR is created successfully
  • Workflow completes without errors

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

Co-authored-by: darkangelpraha <183031713+darkangelpraha@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix multiple issues in Bump Go workflow Fix Bump Go workflow: resolve cache conflicts and hardcoded repository reference Feb 14, 2026
Copilot AI requested a review from darkangelpraha February 14, 2026 04:39
@darkangelpraha darkangelpraha marked this pull request as ready for review February 14, 2026 22:46
Copilot AI review requested due to automatic review settings February 14, 2026 22:46
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_REPOSITORY instead of cli/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'
Copy link

Copilot AI Feb 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
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.

Copilot uses AI. Check for mistakes.

# ---- 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")
Copy link

Copilot AI Feb 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants