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] Not able to compare current commit with the specific commit of a branch(in the Pull request event) #441

Closed
3 tasks done
genieai-vikas opened this issue Mar 20, 2022 · 7 comments
Labels
bug Something isn't working

Comments

@genieai-vikas
Copy link

genieai-vikas commented Mar 20, 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?

I was passing base_sha so I can compare the current commit with the specific commit of a current branch. In v17.3, I can confirm it was working fine. Here is the output this is the base_sha I passed 6fbaee054706cfe09dbd3330e494ffc4fdb3a182 and this is the current sha 92774edb6ac6d323cdf3r74f1e3a8f8237bce051

changed-files
  Resolving repository path...
  Retrieving changes between 6fbaee054706cfe09dbd3330e494ffc4fdb3a182 (undefined) → 92774edb6ac6d323cdf3r74f1e3a8f8237bce051 (feature/add-skip-condition)

but in v18 and v18.3: even after passing base_sha it's comparing the target branch SHA and current branch SHA. here is the output. The value of ${{needs.pre_ci.outputs.PREVIOUS_GITHUB_SHA}} is a891480e4a3927dd6e674e1d0bb50324f078da8a

changed-files
  Resolving repository path...
  Retrieving changes between c5b4bd7dat42eb959aa7be0fre059c88e86afe8f (develop) → 92774edb6ac6d3233df3f74f143a8f82472ce051 (feature/add-skip-condition)

Also, I also tried setting since_last_remote_commit: "true" but it's showing the wrong current SHA. I see this in Logs:

    INPUT_PREVIOUS_SHA: a891480e4a3927dd6e674e1d0bb50324f078da8a
    INPUT_CURRENT_SHA: dede7def9a1a77f620e24c33924c624292a15dd3

but actually, the CURRENT_SHA is 0f4593fb6411c7ad1be277bc0a9872953d2a3403

As [er your comment "To your second point the sha you are seeing is a merge commit of the base branch into your PR branch which is why that’s different and it’s done by the checkout action." but this was not the case in v17.3

To Reproduce

I think there is a new bug in v18 and v18.3. The below code was working fine in 17.3 but not anymore

      - name: Check condition for migration
        uses: tj-actions/changed-files@v17.3
        id: changed-files-specific
        with:
          base_sha: ${{needs.pre_ci.outputs.PREVIOUS_GITHUB_SHA}}
          files: |
           src/microservices/ecommunity/**
            src/microservices/eimage/**
            helm/**

What OS are you seeing the problem on?

macos-11

Expected behavior?

I should be able to compare the latest commit of the current branch with the specific commit of the same branch(In pull request event)

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 Mar 20, 2022
@genieai-vikas genieai-vikas changed the title [BUG] Not able to [BUG] Not able to compare current commit with the specific commit of a branch(in the Pull request event) Mar 20, 2022
@jackton1
Copy link
Member

jackton1 commented Mar 21, 2022

@genieai-vikas Can you provide the entire log output and also include the exact value for base_sha: ${{needs.pre_ci.outputs.PREVIOUS_GITHUB_SHA}}.

Note: The default behavior is to use the last commit of the target branch only when the base_sha is empty.

Can you also confirm that ${{needs.pre_ci.outputs.PREVIOUS_GITHUB_SHA}} is not empty ?

@jackton1
Copy link
Member

jackton1 commented Mar 21, 2022

@genieai-vikas based on this test there doesn’t appear to be a bug. I’ll suggest double checking the output from the previous action.

@genieai-vikas
Copy link
Author

@jackton1 I'll will double-check and let you know.
Also, the test link you share I checked that link and saw your test jobs are terminating with exit code 1. Have you seen this

image

image

@jackton1
Copy link
Member

@genieai-vikas The link I shared redirects to this step in the logs

6631CA53-E8AB-4D11-BE62-1E754817D478

C81C2726-A43B-4E54-90DE-55EECED3FA50

the error you highlighted is coming from a failure test case i.e using a non existing hash

@genieai-vikas
Copy link
Author

genieai-vikas commented Mar 23, 2022

@jackton1 I checked again(with v18.4). Still, It does not show the expected behavior.
${{needs.pre_ci.outputs.PREVIOUS_GITHUB_SHA}} value is dece9076331c0560e2dfef4a2a209a608a7474d2 and
Current SHA value is 1f2e5f6658b50e110a4e817857d93da96af53173

Output logs:

  Run bash $GITHUB_ACTION_PATH/entrypoint.sh
  bash $GITHUB_ACTION_PATH/entrypoint.sh
  shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
  env:
    GITHUB_ACTION_PATH: /home/runner/work/_actions/tj-actions/changed-files/v18.4
    INPUT_FILES_PATTERN_FILE: /tmp/8b73bf4b-4b52-4653-a09d-74b4e02ec424.txt
    INPUT_SEPARATOR:  
    INPUT_PATH: 
    INPUT_PREVIOUS_SHA: c5b4bd7da342eb9f9aa7be0f5e059c88e86afe8f
    INPUT_CURRENT_SHA: 93bd3bfa44ef38f856b96c7aa8ed8b6d053ab6a3
    INPUT_TARGET_BRANCH: develop

Resolving repository path...
  Retrieving changes between c5b4bd7da342eb9f9aa7be0f5e059c88e86afe8f (develop) → 93bd3bfa44ef38f856b96c7aa8ed8b6d053ab6a3 (feature/add-skip-condition)
  Getting diff...
  Non Matching changed files: .github/workflows/build-ci.yml src/microservices/ecommunity/Dockerfile
  Matching modified files: src/microservices/eimage/docker/base/Dockerfile
  Non Matching modified files: .github/workflows/build-ci.yml src/microservices/ecommunity/Dockerfile
  Matching deleted files: src/microservices/eimage/docker/base/Dockerfile
  Added files: 
  Copied files: 
  Deleted files: src/microservices/eimage/docker/base/Dockerfile
  Modified files: 
  Renamed files: 
  Type Changed files: 
  Unmerged files: 
  Unknown files: 
  All changed and modified files: src/microservices/eimage/docker/base/Dockerfile
  All changed files: 
  All modified files: src/microservices/eimage/docker/base/Dockerfile

@discordianfish
Copy link

I have the same issue. It looks like something causes it to use the wrong INPUT_CURRENT_SHA.

@discordianfish
Copy link

Ugh my issue was somewhere else and I tripped over INPUT_CURRENT_SHA being set to the local merge commit which of course isn't available in my local checkout. Anyway, seems to work fine for me.

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