Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error checking out different submodule commits #1715

Open
pespinel opened this issue May 6, 2024 · 1 comment
Open

Error checking out different submodule commits #1715

pespinel opened this issue May 6, 2024 · 1 comment

Comments

@pespinel
Copy link

pespinel commented May 6, 2024

Misc

One workflow runs on master, the submodule points to a commit. Then the same workflow runs on another branch, the submodule points to another different commit.

We are having the following error:

Checking out the ref
  /usr/bin/git checkout --progress --force -B master refs/remotes/origin/master
  Error: fatal: failed to unpack tree object c40ead345284397b4c099ecc5b5ec9586bc9d326
  Error: error: Submodule 'acceptance/resources/users_data' could not be updated.
  Error: error: Submodule 'acceptance/resources/users_data' cannot checkout new HEAD.
  Error: The process '/usr/bin/git' failed with exit code 128

Step:

- name: Checkout
        uses: actions/checkout@v4
        with:
          submodules: 'recursive'
@hpatchett
Copy link

hpatchett commented Feb 19, 2025

We are having a similar issue. Impacts self-hosted agents only.

Any time the submodule reference is changed I will have to delete the work directory under _work in order to get the checkout to be okay again.

I am working around this by doing:

    steps:
      - uses: actions/checkout@v4
      - name: Submodule Update
        run: git submodule update --init --recursive

This seems to allow changes to the submodule whereas:

    steps:
      - uses: actions/checkout@v4
        with:
          submodules: 'recursive'
          token: ${{ secrets.PAT }}

Does not seem to work when the submodule ref changes.

Our submodules are declared using their SSH url as they are private repos in our org. The SSH key is loaded into the self-hosted agent

Would love to see a built-in solution to this, where I can use the PAT token, which works initially, but not for subsequent changes

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

No branches or pull requests

2 participants