-
Notifications
You must be signed in to change notification settings - Fork 38
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
Automatically detecting the default branch name. #55
Comments
Making some good progress. Obviously |
@andstor I think I have something testable working for this... there is likely a few kinks to work out. How do you test Github actions locally for this repo? Or do you just Any info to help in the local testing process would be great :) |
Automatic detection of the default branch is absolutely something we should try to implement 👍 @spencer741 I took a quick look at the git ls-remote --symref https://github.com/andstor/copycat-action HEAD | awk '/^ref:/ {sub(/refs\/heads\//, "", $2); print $2}' It seems to do the trick, but has to be more thoroughly tested, both in terms of reliability and validity. Regarding testing, I have just sat up two private testing repositories and used GitHub Actions directly. This is absolutely not ideal. For this purpose, act seems to be a much better approach. However, I haven't had time to try it out. Please do share your experience if you decide to try it out! 🤩 Manually testing the action's logic (entrypoint.sh) is however, a somewhat painful task when testing for backwards compatibility. I would therefore really like to get some automatic regression testing implemented. If this is something you would be interested in, I would really appreciate it 😍 |
Any progress on this? Surely |
Thanks for bringing this up @danielbayley. I think the owner and I have become extremely busy with life. I'll make a note to myself to dive into this later this week. |
Tell me about it! 😅 |
Automatically detecting the default branch name if the src_branch
and/or
dst_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.
The text was updated successfully, but these errors were encountered: