question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Upgrading @v1.2 -> @v2 can no longer specify short sha in ref

See original GitHub issue

when upgrading to @v2 or later it no longer accepts a single short sha for the ref parameter, and the git command fails:

Setup

uses: actions/checkout@v2.2.0
   with:
     ref: 7daa143

Output:

/usr/bin/git -c protocol.version=2 fetch --no-tags --prune --progress --no-recurse-submodules --depth=5 origin +refs/heads/7daa143*:refs/remotes/origin/7daa143* +refs/tags/7daa143*:refs/tags/7daa143*
  The process '/usr/bin/git' failed with exit code 1
  Waiting 18 seconds before trying again

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:10
  • Comments:8

github_iconTop GitHub Comments

1reaction
jsumnerscommented, Sep 17, 2020

Adding some more info here.

I have a set of steps like:

- name: Lookup Branch
        uses: actions/github-script@v3
        id: pr-branch
        with:
          github-token: ${{ secrets.GITHUB_TOKEN }}
          script: |
            const response = await github.pulls.get({
              owner: context.repo.owner,
              repo: context.repo.repo,
              pull_number: context.issue.number
            })
            return response.data.head.ref

- name: Checkout
        uses: actions/checkout@v2
        with:
          ref: ${{ steps.pr-branch.outputs.result }}
          persist-credentials: false

That resu

This ends up trying to issue the command:

/usr/bin/git -c protocol.version=2 fetch --no-tags --prune --progress --no-recurse-submodules --depth=1 origin +refs/heads/"test-6"*:refs/remotes/origin/"test-6"* +refs/tags/"test-6"*:refs/tags/"test-6"*

Notice that the short ref is being quoted in the command. I don’t know if that matters or not, but it’s definitely failing. Switching back to @v1 works.

1reaction
frode-carlsencommented, Jun 1, 2020

tnx, fetch-depth: 0 doesn’t make any difference, just got a different error. but full sha works. Seems the checkout command it generates assumes it’s a branch or tag when it’s a short hash (7 chars) and thereafter generates an invalid checkout command

With a full sha it generrates this checkout command - same as it should be if a short sha had been treated the same /usr/bin/git -c protocol.version=2 fetch --no-tags --prune --progress --no-recurse-submodules --depth=1 origin +7daa1431d70a06da41e2da7f2ade272bee3d56ca:refs/remotes/pull/515/merge

Read more comments on GitHub >

github_iconTop Results From Across the Web

Git References - Git SCM
When you run git commit , it creates the commit object, specifying the parent of that commit object to be whatever SHA-1 value...
Read more >
The unauthenticated git protocol on port 9418 is no longer ...
First, this error message is indeed expected on Jan. 11th, 2022. See "Improving Git protocol security on GitHub".
Read more >
Commits API - GitLab Docs
An array of action hashes to commit as a batch. See the next table for what attributes it can take. author_email, string, no,...
Read more >
Module Sources | Terraform - HashiCorp Developer
Note that Terraform does not consider an absolute filesystem path (starting ... source = "git::https://example.com/vpc.git?ref=v1.2.0" } # directly select a ...
Read more >
The Difference Between SHA-1, SHA-2 and SHA-256 Hash ...
Note that a large bit-length does not automatically mean a hashing algorithm produces more secure hashes. The construction of the algorithm is also...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found