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

increase the fetch_depth to a number higher than 5000 #812

Closed
2 tasks done
rainabba opened this issue Nov 16, 2022 · 5 comments · Fixed by #810
Closed
2 tasks done

increase the fetch_depth to a number higher than 5000 #812

rainabba opened this issue Nov 16, 2022 · 5 comments · Fixed by #810
Labels
bug Something isn't working replicated

Comments

@rainabba
Copy link

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?

Even with max_fetch_depth: 5000,

I'm getting: Error: Unable to locate the current sha: ******************************* Error: Please verify that current sha is valid, and increase the fetch_depth to a number higher than 5000. Error: Process completed with exit code 1.

To Reproduce

This is on a private, enterprise repo so I can't reproduce publicly. Our workflow in general is to branch from main to a feature/branch, then a PR setup against our QA branch. I'm seeing this on many of those pull-request runs.

What OS are you seeing the problem on?

ubuntu-18.04

Expected behavior?

A non-error outcome, or more useful value suggested.

Relevant log output

# execution

Run tj-actions/changed-files@v34
  with:
    since_last_remote_commit: true
    dir_names: true
    fetch_depth: 5000
    separator:  
    include_all_old_new_renamed_files: false
    old_new_separator: ,
    old_new_files_separator:  
    files_separator: 
  
    files_ignore_separator: 
  
    sha: *******************************
    path: .
    quotepath: true
    json: false
    max_fetch_depth: 5000

Output

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: my-org/my-repo
    GITHUB_REF: refs/pull/9531/merge
    GITHUB_BASE_REF: qa
    GITHUB_HEAD_REF: feature/my-new-feature
    GITHUB_WORKSPACE: /runner/_work/my-repo/my-repo
    GITHUB_EVENT_PULL_REQUEST_BASE_SHA: *******************************
    GITHUB_EVENT_BEFORE: 
    GITHUB_EVENT_FORCED: 
    INPUT_SHA: *******************************
    INPUT_BASE_SHA: 
    INPUT_SINCE: 
    INPUT_UNTIL: 
    INPUT_PATH: .
    INPUT_FETCH_DEPTH: 5000
    INPUT_MAX_FETCH_DEPTH: 5000
    INPUT_SINCE_LAST_REMOTE_COMMIT: true
changed-files-diff-sha
  Verifying git version...
  Valid git version found: (2.38.1)
  Running on a pull request event...
  Fetching remote refs...
  Error: Unable to locate the current sha: *******************************
  Error: Please verify that current sha is valid, and increase the fetch_depth to a number higher than 5000.
  Error: Process completed with exit code 1.


### Anything else?

Thanks for this Action. I'd written my own, but wasn't satisfied with the behavior (it seemed to be listing FAR too many changes), and this observation may be directly correlated with this error, but that's just a guy feel and I don't have a clear idea what/how to check as of yet.

### Code of Conduct

- [X] I agree to follow this project's Code of Conduct
@rainabba rainabba added the bug Something isn't working label Nov 16, 2022
@rainabba
Copy link
Author

Btw, the following is what I'm using for pull-requests (your action for everything else):

mapfile CHANGED_FILES < <(curl -s -H "Accept: application/vnd.github+json" -H "Authorization: Bearer $GITHUB_TOKEN" https://api.github.com/repos/$GITHUB_REPOSITORY_OWNER/$GITHUB_REPOSITORY/pulls/${{ github.event.pull_request.number }}/files | jq -r '.[].filename');
echo "CHANGED_FILES=${CHANGED_FILES[@]}" >> $GITHUB_ENV;

@github-actions
Copy link
Contributor

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

@rainabba rainabba changed the title [BUG] <title> increase the fetch_depth to a number higher than 5000 Nov 16, 2022
@jackton1 jackton1 linked a pull request Nov 17, 2022 that will close this issue
@jackton1
Copy link
Member

jackton1 commented Nov 17, 2022

High-level description: This bug occurs when the fork point and the last commit of the base branch differ, resulting in errors finding the merge-base as the checkout action merges the tip of the target branch to the PR branch.

To prevent this error going forward a pre-check to determine the validity of merge-base would be used falling back to the last commit of the target branch where necessary.

@rainabba
Copy link
Author

Thanks for confirming the bug. To be clear, are you saying that I should setup that pre-check, or that will be added to the action [soon]? :D

@jackton1
Copy link
Member

@rainabba This was already implemented in the latest release, I'll suggest you upgrade (if you use semver) or re-run the action (if you use the major version).

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

Successfully merging a pull request may close this issue.

2 participants