-
Notifications
You must be signed in to change notification settings - Fork 312
Open
Labels
bugSomething isn't workingSomething isn't working
Description
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:
- When we trigger the github action for the first time, with create-target-branch-if-needed set to true, the github action proceeds properly.
- 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 - This is because of this part of the code , which causes git to fail
- 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
- Could we have some feature that can support this use case.
Apologies, if this already handled and guide me to the documentation.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working