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] Unable to fetch file changes on merge event #615

Closed
3 tasks done
okamosy opened this issue Sep 7, 2022 · 1 comment · Fixed by #617
Closed
3 tasks done

[BUG] Unable to fetch file changes on merge event #615

okamosy opened this issue Sep 7, 2022 · 1 comment · Fixed by #617
Labels
bug Something isn't working

Comments

@okamosy
Copy link

okamosy commented Sep 7, 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?

When using this action to generate a list of changed folders, it fails to set the hashes correctly on a merge event. I get the following error: Similar commit hashes detected: previous sha: df2be13f61f134c597730151b8282627c4341643 is equivalent to the current sha: df2be13f61f134c597730151b8282627c4341643

To Reproduce

I've created a simple repo to test this. It can be forked here: https://github.com/okamosy/gha-test

The workflow in this only triggers on pull_request events

  1. Create a new branch
  2. Modify one or more of the readmes scattered throughout the project
  3. Push the branch and raise a pr
  4. Once the running action is complete, merge the PR
  5. Examine the triggered action

What OS are you seeing the problem on?

ubuntu-latest or ubuntu-20.04

Expected behavior?

I would expect a list of modified folders to be displayed in the output step as is seen when the action runs when the PR is raised.

Relevant log output

# "Set base sha..."
  if [[ -n "" ]]; then
    BASE_SHA=$(git log --format="%H" --date=local --since="" --reverse | head -n 1)
    echo "::set-output name=base_sha::$BASE_SHA"
  elif [[ -n "" ]]; then
    echo "::set-output name=base_sha::"
  elif [[ "false" == "true" && "" == "true" && "" != "0000000000000000000000000000000000000000" ]]; then
    LAST_REMOTE_COMMIT=$(git rev-parse $(git branch -r --sort=-committerdate | head -1))
    if [[ "8c40a3b020d8e4f5885e97b71425e51ed72ee282" != "$LAST_REMOTE_COMMIT" ]]; then
      echo "::set-output name=base_sha::$LAST_REMOTE_COMMIT"
    fi
  elif [[ "false" == "true" && "" != "true" && "" != "0000000000000000000000000000000000000000" ]]; then
    echo "::set-output name=base_sha::"
  fi
  shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
##[debug]/usr/bin/bash --noprofile --norc -e -o pipefail /home/runner/work/_temp/01f3a1f2-6041-491c-986a-95667575aba4.sh
##[debug]Finished: run
##[debug]Evaluating condition for step: 'run'
##[debug]Evaluating: success()
##[debug]Evaluating success:
##[debug]=> true
##[debug]Result: true
##[debug]Starting: run
##[debug]Loading inputs
##[debug]Evaluating: format('# "Set the sha..."
##[debug]if [[ -n "{0}" ]]; then
##[debug]  SHA=$(git log -1 --format="%H" --date=local --until="{1}")
##[debug]  echo "::set-output name=sha::$SHA"
##[debug]else
##[debug]  echo "::set-output name=sha::{2}"
##[debug]fi
##[debug]', inputs.until, inputs.until, inputs.sha)
##[debug]Evaluating format:
##[debug]..Evaluating String:
##[debug]..=> '# "Set the sha..."
##[debug]if [[ -n "{0}" ]]; then
##[debug]  SHA=$(git log -1 --format="%H" --date=local --until="{1}")
##[debug]  echo "::set-output name=sha::$SHA"
##[debug]else
##[debug]  echo "::set-output name=sha::{2}"
##[debug]fi
##[debug]'
##[debug]..Evaluating Index:
##[debug]....Evaluating inputs:
##[debug]....=> Object
##[debug]....Evaluating String:
##[debug]....=> 'until'
##[debug]..=> ''
##[debug]..Evaluating Index:
##[debug]....Evaluating inputs:
##[debug]....=> Object
##[debug]..Evaluating String:
##[debug]..=> 'sha'
##[debug]=> '8c40a3b020d8e4f5885e97b71425e51ed72ee282'
##[debug]Result: '8c40a3b020d8e4f5885e97b71425e51ed72ee282'
##[debug]Evaluating: steps.base-sha.outputs.base_sha
##[debug]Evaluating Index:
##[debug]..Evaluating Index:
##[debug]....Evaluating Index:
##[debug]......Evaluating steps:
##[debug]......=> Object
##[debug]......Evaluating String:
##[debug]......=> 'base-sha'
##[debug]....=> Object
##[debug]....Evaluating String:
##[debug]....=> 'outputs'
##[debug]..=> Object
##[debug]..Evaluating String:
##[debug]..=> 'base_sha'
##[debug]=> null
##[debug]Result: null
##[debug]Evaluating: inputs.path
##[debug]Evaluating Index:
##[debug]..Evaluating inputs:
##[debug]..=> Object
##[debug]..Evaluating String:
##[debug]..=> 'path'
##[debug]=> '.'
##[debug]Result: '.'
##[debug]Evaluating: inputs.use_fork_point
##[debug]Evaluating Index:
##[debug]..Evaluating inputs:
##[debug]..=> Object
##[debug]..Evaluating String:
##[debug]..=> 'use_fork_point'
##[debug]=> 'false'
##[debug]Result: 'false'
##[debug]Evaluating condition for step: 'run'
##[debug]Evaluating: success()
##[debug]Evaluating success:
##[debug]=> true
##[debug]Result: true
##[debug]Starting: run
##[debug]Loading inputs
##[debug]Loading env
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: okamosy/gha-test
    GITHUB_BASE_REF: main
    GITHUB_HEAD_REF: test-2
    GITHUB_ACTION_PATH: /home/runner/work/_actions/tj-actions/changed-files/v29.0.3
    GITHUB_WORKSPACE: /home/runner/work/gha-test/gha-test
    INPUT_SHA: 8c40a3b020d8e4f5885e97b71425e51ed72ee282
    INPUT_BASE_SHA: 
    INPUT_PATH: .
    INPUT_USE_FORK_POINT: false
##[debug]/usr/bin/bash --noprofile --norc -e -o pipefail /home/runner/work/_temp/928fbc2d-a1b2-4a3f-828d-ae1873f9faee.sh
::group::changed-files-diff-sha
changed-files-diff-sha
  ##[debug]Resolving repository path: /home/runner/work/gha-test/gha-test/.
  Verifying git version...
  Valid git version found: (2.37.3)
  ##[debug]Getting HEAD SHA...
  ##[debug]Verifying the current commit SHA: 8c40a3b020d8e4f5885e97b71425e51ed72ee282
  ##[debug]Current SHA: 8c40a3b020d8e4f5885e97b71425e51ed72ee282
  ##[debug]GITHUB_BASE_REF: main...
  remote: Total 0 (delta 0), reused 0 (delta 0), pack-reused 0        
  ##[debug]Previous SHA: 8c40a3b020d8e4f5885e97b71425e51ed72ee282
  ##[debug]Verifying the previous commit SHA: 8c40a3b020d8e4f5885e97b71425e51ed72ee282
  Error: Similar commit hashes detected: previous sha: 8c40a3b020d8e4f5885e97b71425e51ed72ee282 is equivalent to the current sha: 8c40a3b020d8e4f5885e97b71425e51ed72ee282
  Error: 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?

No response

Code of Conduct

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

github-actions bot commented Sep 7, 2022

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

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

Successfully merging a pull request may close this issue.

1 participant