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

Action fails when it is triggered for more than one time from the same branch #113

Open
sudharshanrao91 opened this issue Mar 28, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@sudharshanrao91
Copy link

sudharshanrao91 commented Mar 28, 2024

Hi team,
First of all, thank you for this cool github action which simplifies one of our use cases.
Now, let's get to the bug part.

We are using this action to push some code to a target repo. The action works well as expected, except for one scenario:

  1. When we trigger the github action for the first time, with create-target-branch-if-needed set to true, the github action proceeds properly.
  2. When we trigger it again from the same branch/PR (let's say we had some changes that needed to be done on the same PR/branch), create-target-branch-if-needed is already set to true and the action fails with the below error
    fatal: a branch named <branch_name> already exists
  3. This is because of this part of the code , which causes git to fail
  4. As a workaround, we added a condition to check whether the target branch is already present, and dynamically set the create-target-branch-if-needed attribute:
if [ $(git ls-remote --heads https://github.com/xxxx/yyy.git $CURRENT_BRANCH | wc -l ) == 1 ]; then
  echo "CREATE_TARGET_BRANCH=false" >> $GITHUB_ENV
else
   echo "CREATE_TARGET_BRANCH=true" >> $GITHUB_ENV
fi
  1. Could we have some feature that can support this use case.

Apologies, if this already handled and guide me to the documentation.

@sudharshanrao91 sudharshanrao91 added the bug Something isn't working label Mar 28, 2024
@yedidyas
Copy link

yedidyas commented Mar 2, 2025

have the same issue

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

2 participants