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] Please verify that the previous sha is valid, and increase the fetch_depth to a number higher than 40. #790

Closed
3 tasks done
genieai-vikas opened this issue Nov 8, 2022 · 9 comments
Labels
bug Something isn't working

Comments

@genieai-vikas
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?

Hello, I was using v17.3 and it was working now. Now I started using version 34.3.3 but now my pipeline is failing.
I am getting this error:

  Error: Unable to locate the previous sha: 8f8bbe6058594a7b820988956de59faba3f1b1bc
  Error: Please verify that the previous sha is valid, and increase the fetch_depth to a number higher than 40.
  Error: Process completed with exit code 1.

Basically, I have created a PR(develop <- feature/xxx) now every time I push github CI triggered the build because of synchronization. I compare (current - 1) to current commit of my feature branch and build only certain parts of code as per the changes

To Reproduce

      - name: check if MS changed
        uses: tj-actions/changed-files@v34.3.3
        id: changed-files-specific-1
        with:
          base_sha: ${{needs.previous_commit.outputs.PREVIOUS_GITHUB_SHA}}
          files: |
            src/microservices/A/**
            src/microservices/B/**

What OS are you seeing the problem on?

ubuntu-latest or ubuntu-20.04

Expected behavior?

It should compare the previous commit with the current commit and if any files are changed then it should return true or false

Relevant log output

No response

Anything else?

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@genieai-vikas genieai-vikas added the bug Something isn't working label Nov 8, 2022
@jackton1
Copy link
Member

jackton1 commented Nov 8, 2022

@genieai-vikas can you include the configuration for the checkout action?

@genieai-vikas
Copy link
Author

@jackton1 Thanks for the help. here is the checkout action

    steps:
      - uses: actions/checkout@v2.5.0
        with:
          fetch-depth: 2

@jackton1
Copy link
Member

jackton1 commented Nov 8, 2022

Okay, I'll recommend using

      - name: check if MS changed
        uses: tj-actions/changed-files@v34.3.3
        id: changed-files-specific-1
        with:
          base_sha: ${{needs.previous_commit.outputs.PREVIOUS_GITHUB_SHA}}
          since_last_remote_commit: true
          files: |
            src/microservices/A/**
            src/microservices/B/**

Based on your comment

I compare (current - 1) to current commit of my feature branch and build only certain parts of code as per the changes

@genieai-vikas
Copy link
Author

@jackton1 tried but still getting the same error

image

@jackton1
Copy link
Member

jackton1 commented Nov 8, 2022

@genieai-vikas Can you include the full log output with debugging enabled this can be done by rerunning the workflow

@jackton1 jackton1 closed this as not planned Won't fix, can't repro, duplicate, stale Nov 8, 2022
@jackton1
Copy link
Member

jackton1 commented Nov 8, 2022

@genieai-vikas Closing this for now as I’ll need more information to reproduce the bug. Please include more information including your workflow file and provide the related log output in order to reopen the issue. Thanks

@rainabba
Copy link

@jackton1 I your suggest above, can you explain the referenced "previous_commit" job? needs.previous_commit.outputs.PREVIOUS_GITHUB_SHA

I'm getting the same depth error in some runs, but not others.

@jackton1
Copy link
Member

jackton1 commented Nov 10, 2022

@rainabba I'm not entirely sure how the workflow is implemented. i.e where the needs.previous_commit.outputs.PREVIOUS_GITHUB_SHA so I can't provide any direction in that regard. I'll recommend using the provided inputs.

Note: This can be achieved by setting the since_last_remote_commit to true

E.g

      - name: check if MS changed
        uses: tj-actions/changed-files@v34
        id: changed-files-specific-1
        with:
          since_last_remote_commit: true
          files: |
            src/microservices/A/**
            src/microservices/B/**

@rainabba
Copy link

Okay. I thought it might have been some vudu I wasn't understanding.

I'm presently stuck. Many of my runs are failing like the following. I've gone from 40 all the way up to the max of 5000 and it makes no difference (as seen below.) Any advice?

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

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.

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