-
Notifications
You must be signed in to change notification settings - Fork 38
Description
Automatically detecting the default branch name if the src_branchand/ordst_branch` names are not provided by user.
Background:
A while back, GitHub started naming the master branch "main" by default. Since copycat-action looks for a "master" branch by default, you have to explicitly provide branch names if you are using Github's new naming convention "main" for your default branch. Obviously if you are already using custom branch names, you have to explicitly specify them.
Instead of assuming each default branch name is always "master", we need to automatically detect the name to explicitly use it to clone the src and dst repos.
I believe below is a reliable way to get the default branch name.
git remote show upstream | grep "HEAD branch" | sed 's/.*: //'
I will work on a PR to test this out.