Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Pin check-uvlockfile checkout ref to main to avoid missing PR branch fetches#1418

Merged
sscargal merged 2 commits into
mainfrom
copilot/fix-checkout-to-main-branch
May 19, 2026
Merged

Pin check-uvlockfile checkout ref to main to avoid missing PR branch fetches#1418
sscargal merged 2 commits into
mainfrom
copilot/fix-checkout-to-main-branch

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 19, 2026

Check uv.lock file fails at actions/checkout when the workflow attempts to fetch a PR head branch that is not present on origin. This change makes checkout deterministic by always resolving against main in that workflow.

  • Workflow behavior change

    • Updated .github/workflows/check-uvlockfile.yml to stop deriving checkout ref from github.head_ref.
    • Pinned checkout to main so the job no longer depends on the triggering PR branch existing on the remote.
  • Scope

    • Single-line change in the checkout step; no other job logic changed.
- uses: actions/checkout@v6
  with:
    ref: main
    token: ${{ secrets.GITHUB_TOKEN }}
Original prompt

Problem

The Check uv.lock file workflow (job logs) fails at the actions/checkout step because git tries to fetch the PR's remote branch (feat/add-litellm-language-model), which does not exist on the remote:

/usr/bin/git -c protocol.version=2 fetch --no-tags --prune --no-recurse-submodules --depth=1 origin +refs/heads/feat/add-litellm-language-model*:refs/remotes/origin/feat/add-litellm-language-model* ...
The process '/usr/bin/git' failed with exit code 1

Fix

In .github/workflows/check-uvlockfile.yml, add ref: main to the actions/checkout step so it always checks out the main branch instead of the triggering PR's remote branch:

- uses: actions/checkout@v6
  with:
    ref: main

The following is the prior conversation context from the user's chat exploration (may be truncated):

User: Please find a solution for this failing job. Use the logs, job definition, and any referenced files where the failure occurred. Keep your response focused on the solution and include code suggestions when appropriate.

Assistant: Let me grab the logs for that job right away!

Assistant: ## Root Cause

The job fails at the actions/checkout step because actions/checkout@v6 does not exist — the current latest major version is v4. This causes the git fetch to fail with exit code 1 after retrying three times.

Fix

Update line 23 in .github/workflows/check-uvlockfile.yml to use a valid version:

# Before
- uses: actions/checkout@v6

# After
- uses: actions/checkout@v4

The full corrected workflow:

name: Check uv.lock file
permissions:
  contents: read

on:
  pull_request:
    paths:
      - 'pyproject.toml'
      - 'uv.lock'
      - 'packages/**/pyproject.toml'
  workflow_dispatch:

jobs:
  check-lock:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4  # ✅ Fixed: v6 does not exist

      - name: Install uv
        uses: astral-sh/setup-uv@v4

      - name: Check lockfile
        run: uv lock --check

Commit this change to the feat/add-litellm-language-model branch and the workflow should proceed past checkout and run uv lock --check successfully.

User: ```
/usr/bin/git -c protocol.version=2 fetch --no-tags --prune --no-recurse-submodules --depth=1 origin +refs/heads/feat/add-litellm-language-model*:refs/remotes/origin/feat/add-litellm-language-model* +refs/tags/feat/add-litellm-language-model*:refs/tags/feat/add-litellm-language-model*
The process '/usr/bin/git' failed with exit code 1

Incorrect. https://github.com/actions/checkout/releases/tag/v6.0.2 shows v6.0.2 is the latest version of `checkout`. 

The problem is when `git` tries to checkout some data in a remote branch that doesn't exist. We should only ever use local `main` branch.



Assistant: You're right, apologies for the incorrect diagnosis. The fix is to pin the `actions/checkout` step to always use the `main` branch by adding `ref: main`, so it never tries to fetch the PR's remote branch.

```yaml name=.github/workflows/check-uvlockfile.yml url=https://github.com/MemMachine/MemMachine/blob/1cd65974381c4ad8c43400465d103577c53186d0/.github/workflows/check-uvlockfile.yml#L23-L24
      - uses: actions/checkout@v6
        with:
          ref: main  # ✅ Always check out main, never the PR's remote branch

This explicitly tells actions/checkout to fetch refs/heads/main rather than the triggering PR branch (feat/add-litellm-language-model), which doesn't exist on the remote.

Would you like me to apply this fix directly to the file?

User: Create a new pull request with the fix.

Assistant: We're waiting for your response to the confirmation dialog to proceed with creating the pull request.

This pull request was created from Copilot chat.

Copilot AI changed the title [WIP] Fix checkout step to reference main branch Pin check-uvlockfile checkout ref to main to avoid missing PR branch fetches May 19, 2026
Copilot AI requested a review from sscargal May 19, 2026 21:01
Copy link
Copy Markdown
Contributor

@sscargal sscargal left a comment

Choose a reason for hiding this comment

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

LGTM

@sscargal sscargal marked this pull request as ready for review May 19, 2026 23:51
@sscargal sscargal merged commit d81020c into main May 19, 2026
52 checks passed
@sscargal sscargal deleted the copilot/fix-checkout-to-main-branch branch May 19, 2026 23:51
@edwinyyyu
Copy link
Copy Markdown
Contributor

This is wrong. Reverting in #1432

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