'Github actions - git subtree - Maximum function recursion depth?

I'm trying to git clone one repository in another repository GitHub action in order to do something (open PR on every merge in the submodels repository and merge it in the father repository). In 1 repository everything works as I want, but in another repository, I'm getting this error:

/usr/lib/git-core/git-subtree: 729: Maximum function recursion depth (1000) reached

The repository that succeeds is the "biggest" repository and has a lot more files. The GitHub action is the same action at both of the repositories. Does someone have any clue what can cause this? what can I do in order to fix that? In my action, I don't have anything that related to recursion... can't find anything about this on google. This is my action:

jobs:
   linux:
    name: Linux
    runs-on: ubuntu-latest

    steps:

    - name: Test
      run: |
        git config --global user.email "**************"
        git config --global user.name "************"
        eval "$(ssh-agent -s)"
        ssh-add - <<< "${{ secrets.PRIVATE_KEY }}"
        git clone [email protected]:********/**********.git /home/runner/********
        cd /home/runner/*********
        RANDOM_BRANCH_NAME=udi_$((1 + $RANDOM * 1000))
        git remote add origin-es [email protected]:***********/**********.git
        git subtree pull --prefix=*********/es_models origin-es master
        git subtree push --prefix=*********/es_models origin $RANDOM_BRANCH_NAME


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source