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

Cannot checkout named v8 ref in a container #1876

Open
laverdet opened this issue Sep 3, 2024 · 3 comments
Open

Cannot checkout named v8 ref in a container #1876

laverdet opened this issue Sep 3, 2024 · 3 comments

Comments

@laverdet
Copy link

laverdet commented Sep 3, 2024

This action does not work correctly from a container workflow.

name: Build
on: [ push ]
jobs:
  build:
    runs-on: ubuntu-latest
    container: debian:experimental-20240812
    steps:
      - uses: actions/checkout@v4
        with:
          ref: "12.8.20"
          repository: v8/v8

A failed run is here:
https://github.com/laverdet/checkout-bug/actions/runs/10690612018/job/29635384696

Logs copy/pasted below here:

Run actions/checkout@v4
/usr/bin/docker exec  7decb8ab921da4135c8fd3c2d1401826f3be7aa4ff4d407986b566668edfe365 sh -c "cat /etc/*release | grep ^ID"
Syncing repository: v8/v8
Getting Git version info
Deleting the contents of '/__w/checkout-bug/checkout-bug'
The repository will be downloaded using the GitHub REST API
To create a local Git repository instead, add Git 2.[18](https://github.com/laverdet/checkout-bug/actions/runs/10690612018/job/29635384696#step:3:19) or higher to the PATH
Downloading the archive
The first argument must be of type string or an instance of Buffer, ArrayBuffer, or Array or an Array-like Object. Received an instance of Object
Waiting 10 seconds before trying again
Downloading the archive
The first argument must be of type string or an instance of Buffer, ArrayBuffer, or Array or an Array-like Object. Received an instance of Object
Waiting 18 seconds before trying again
Downloading the archive
Error: The first argument must be of type string or an instance of Buffer, ArrayBuffer, or Array or an Array-like Object. Received an instance of Object

If I change ref to "tags/12.8.20" then it works. Additionally if I run without a container then it works.

@jekru
Copy link

jekru commented Sep 26, 2024

If possible, install Git > 2.18 in the container. When not available, the Github REST API12 will be used as fallback3 and may lead to unexpected behavior4.

In the release of Version 12.8.20, you can find the asset download link(s), for example /v8/v8/archive/refs/tags/12.8.20.zip and will be used via REST API in the fallback. When branches and tags would share the same ref structure, this would require unique naming between branches/tags and 12.8.20 already exists as both56.

When Git 2.18 or higher is not in your PATH, falls back to the REST API to download the files.

Footnotes

  1. Download a repository archive (tar)

  2. Download a repository archive (zip)

  3. https://github.com/actions/checkout/blob/d632683dd7b4114ad314bca15554477dd762a938/README.md?plain=1#L11

  4. https://github.com/actions/checkout/issues?q=is%3Aissue+git

  5. branch: 12.8.20

  6. tag: 12.8.20

@laverdet
Copy link
Author

Thanks for the pointers. Of course I can work around the problem by installing git in the container. It doesn't change the fact that the fallback behavior is bewildering. If the fallback is broken then it should be fixed or removed.

@jekru
Copy link

jekru commented Sep 26, 2024

If the fallback is broken then it should be fixed or removed.

For sure! I didn't know that you were aware about the underlying problem.

Related to #1879.

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