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.

Unable to determine current hash with `git rev-parse HEAD`

See original GitHub issue

I’m having this error when I activate temporaryPublicStorage: true.

This is the run: https://github.com/frontity/frontity/pull/244/checks?check_run_id=339869140

And this is the workflow job:

  lighthouse:
    runs-on: ubuntu-latest
    needs: deploy

    steps:
      - name: Audit URLs using Lighthouse
        uses: treosh/lighthouse-ci-action@v2
        with:
          temporaryPublicStorage: true
          urls: |
            https://mars-theme-frontity.worona.now.sh/
            https://mars-theme-frontity.worona.now.sh/2016/the-beauties-of-gullfoss/

By looking at the specific line that throws the error: https://github.com/GoogleChrome/lighthouse-ci/blob/master/packages/utils/src/build-context.js#L54 it looks like lighthouse is trying to use git rev-list -n1 HEAD to get the commit hash.

Just before that, it looks for some environment variables. I have solved the issue adding the env LHCI_BUILD_CONTEXT__CURRENT_HASH populated with ${{ github.sha }}.

I’m not sure why I am having this problem, but in case you can reproduce it, maybe this package should add the LHCI_BUILD_CONTEXT__CURRENT_HASH env variable by default:

env:
  LHCI_BUILD_CONTEXT__CURRENT_HASH: ${{ github.sha }}

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:3
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
milewskicommented, Jan 19, 2021

Actually, I figured it out…

Looking at the log for checkout@v2 I saw this:

image

As I’m using a self-hosted runner I had an old version of git… upgrading it… now there is indeed a .git folder in my root directory and everything works as expected.

1reaction
alekseykulikovcommented, Dec 11, 2019
Read more comments on GitHub >

github_iconTop Results From Across the Web

How do I get the hash for the current commit in Git?
To turn any extended object reference into a hash, use git-rev-parse : git rev-parse HEAD. or git rev-parse --verify HEAD. To retrieve the...
Read more >
git-rev-parse Documentation - Git
Use git rev-parse in option parsing mode (see PARSEOPT section below). ... The path shown, when relative, is relative to the current working...
Read more >
How to retrieve the hash for the current commit in Git
We initialize a Git repository, add the created file, and then commit it. Finally, we get the hash of the last commit using...
Read more >
Lighthouse CI Client fails in AWS CodePipeline / CodeBuild
10 ⚠️ LHCI server non-unique build for this hash. 11 ERROR: Unable to determine current branch with `git rev-parse --abbrev-ref HEAD` ...
Read more >
HASH=`git rev-parse HEAD` - Dataquest Community
After looking at different sources on the web, I still can't understand what this part of the code is doing. Can somebody explain?...
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