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

Store main/master branch in variable and update documentation #20

Open
mathewvaughan opened this issue Jan 29, 2021 · 1 comment
Open

Comments

@mathewvaughan
Copy link

mathewvaughan commented Jan 29, 2021

Some pre-amble:

I borrowed your script (Thank you so much) for a personal project of mine, and I wanted to give back with some feedback! I would also love to be involved with extending your work: I genuinely think the mono-repo is the way to go but it can be very difficult to get tools to play nicely with them! So yeah - thanks again!

Issue:

Github now encourages a default branch of 'main' instead of master, and I guess some people might prefer to use a different name (Who knows why??). So running your script for my new repo fails: it can't find master (my branch is called main)

Solutions:

Initially I thought maybe extracting the name of the main branch into a variable and allowing the user to set this in the script (or even as an Env var in circleci) would be useful, however on second thoughts I wonder if a slightly more robust way might be to query their remote for the "default branch from with .circleci/circle_trigger.sh.

Final comments:

I don't know the exact details of how to get this properly working (some googling led me to a solution that might work, but I'd anticipate hitting some caveats). I'd be happy to put a PR in if you're interested!

Edit: I don't understand bash well yet - so if this is already intended behaviour I may have missed it.

@dimadeveatii
Copy link
Member

Hi @mathewvaughan, this is a good point. I think I missed it because when I first implemented the v1 script, Github was still using master as a default branch.

In terms of a stable solution, I don't think there is a reliable way to get a remote default branch, or at least I don't know of any ways to get it. My suggestion would be to make it configurable via an env variable like DEFAULT_BRANCH. When present use it, otherwise default to current master.

You're more than welcome to open a PR for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants