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

[BUG] Intermittent "Unable to locate the current sha" #458

Closed
3 tasks done
scottwn opened this issue Mar 29, 2022 · 8 comments
Closed
3 tasks done

[BUG] Intermittent "Unable to locate the current sha" #458

scottwn opened this issue Mar 29, 2022 · 8 comments
Labels
bug Something isn't working

Comments

@scottwn
Copy link

scottwn commented Mar 29, 2022

Is there an existing issue for this?

  • I have searched the existing issues

Does this issue exist in the latest version?

  • I'm using the latest release

Describe the bug?

On ~10% of runs, I see this output and the action fails.

Warning: Unable to locate the current sha: 0557cdadedb1fd4a763bb7306f3ab68c0ed1f8ca
Warning: You seem to be missing 'fetch-depth: 0' or 'fetch-depth: 2'. See https://github.com/tj-actions/changed-files#usage

I have confirmed that I'm using fetch-depth: 0.

To Reproduce

I'm not able to reproduce the behavior. It seems to happen intermittently. Interestingly, when it does happen, re-running the action fails with the same error. But I'm not sure what causes the initial failure.

What OS are you seeing the problem on?

ubuntu-latest or ubuntu-20.04

Expected behavior?

I expect the action to be able to fetch history successfully.

Relevant log output

Run tj-actions/changed-files@v18.4
  with:
    files: VERSION
  
    token: ***
    separator:  
    files_separator: 
  
    files_ignore_separator: 
  
    sha: 0557cdadedb1fd4a763bb7306f3ab68c0ed1f8ca
    since_last_remote_commit: false
    use_fork_point: false
Run # "Set base sha..."
  # "Set base sha..."
  if [[ -n "" ]]; then
    echo "::set-output name=base_sha::"
  elif [[ "false" == "true" && "ba0e94f9f5455cb3bf611a3bb9272c7bd7e07235" != "0000000000000000000000000000000000000000" ]]; then
      echo "::set-output name=base_sha::ba0e94f9f5455cb3bf611a3bb9272c7bd7e07235"
  fi
  shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
Run # "Calculating the previous and current SHA..."
  # "Calculating the previous and current SHA..."
  bash $GITHUB_ACTION_PATH/diff-sha.sh
  shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
  env:
    GITHUB_SERVER_URL: https://github.com
    GITHUB_REPOSITORY: AgnostiqHQ/covalent
    GITHUB_BASE_REF: develop
    GITHUB_HEAD_REF: ci-fix
    GITHUB_ACTION_PATH: /home/runner/work/_actions/tj-actions/changed-files/v18.4
    INPUT_SHA: 0557cdadedb1fd4a763bb7306f3ab68c0ed1f8ca
    INPUT_BASE_SHA: 
    INPUT_TOKEN: ***
    INPUT_PATH: 
    INPUT_USE_FORK_POINT: false
changed-files-diff-sha
  Resolving repository path...
  Setting up 'temp_changed_files' remote...
  No 'temp_changed_files' remote found
  Creating 'temp_changed_files' remote...
  Getting HEAD SHA...
  Warning: Unable to locate the current sha: 0557cdadedb1fd4a763bb7306f3ab68c0ed1f8ca
  Warning: You seem to be missing 'fetch-depth: 0' or 'fetch-depth: 2'. See https://github.com/tj-actions/changed-files#usage
  Error: Process completed with exit code 1.

Anything else?

The workflow that uses the action: https://github.com/AgnostiqHQ/covalent/blob/develop/.github/workflows/version.yml
Example failed run: https://github.com/AgnostiqHQ/covalent/actions/runs/2059600589
Example successful run: https://github.com/AgnostiqHQ/covalent/actions/runs/2059933529

Code of Conduct

  • I agree to follow this project's Code of Conduct
@scottwn scottwn added the bug Something isn't working label Mar 29, 2022
@github-actions
Copy link
Contributor

Thanks for reporting this issue, don't forget to star this project to help us reach a wider audience.

@jackton1
Copy link
Member

@scottwn You might have to upgrade the checkout action as directed by the docs

@jackton1
Copy link
Member

Some known conditions where this might happen:

  1. Force push a commit which overrides the commit hash

  2. Deleting a branch during the workflow execution.

@jackton1
Copy link
Member

jackton1 commented Mar 29, 2022

@scottwn looking at this workflow execution the previous step also fails since the commit no longer exists.

https://github.com/AgnostiqHQ/covalent/runs/5740169813?check_suite_focus=true#step:3:6

I’ll recommend double-checking that the branch exists and the commit isn’t squashed or deleted

@dmohns
Copy link

dmohns commented May 24, 2022

Hey, I'm still encountering this issue. Although it looks a bit different to what was originally reported here. Should I create a new issue or post information here?

@jackton1
Copy link
Member

@dmohns Sure

@dmohns
Copy link

dmohns commented May 24, 2022

Similar to the OP we encounter the issue

  Warning: Unable to locate the previous sha: 
  Warning: You seem to be missing 'fetch-depth: 0' or 'fetch-depth: 2'. See https://github.com/tj-actions/changed-files#usage

in an un-reproducible way. Sometimes rebasing and force-pushing fixes it, sometimes merging main fixes it. But also sometimes neither of them does.

The configuration I use is

jobs:
  sqlfluff:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
        with:
          fetch-depth: 0  # OR "2" -> To retrieve the preceding commit.
      - name: Get changed files
        id: changed-files
        uses: tj-actions/changed-files@v20
        with:
          use_fork_point: "true"

Example error

  Resolving repository path...
  Getting HEAD SHA...
  Getting fork point...
  From https://github.com/***
   * [new branch]            main       -> main
  Verifying commit SHA...
  Warning: Unable to locate the previous sha: 
  Warning: You seem to be missing 'fetch-depth: 0' or 'fetch-depth: 2'. See https://github.com/tj-actions/changed-files#usage
  Error: Process completed with exit code 1.

Note how previous sha is empty. Unfortunately this happens in private repos and I cannot share the exact workflow run.

To investigate further I was wondering if there is a way to run this in "debug" mode? I.e. set -x somehow?

Steps taken so far:

  • Ensure we are using latest Checkout action
  • Double check no branches get deleted during workflow execution
  • We sometimes force-push after rebases. But I don't think this should be related?

@dmohns
Copy link

dmohns commented May 30, 2022

I'll actually create a new issue for this, as after some investigation I think it's unrelated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants