-
-
Notifications
You must be signed in to change notification settings - Fork 57
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
Feature: #deploy to main or master refs #188
Feature: #deploy to main or master refs #188
Conversation
4e586dd
to
6614ede
Compare
6614ede
to
ce368d3
Compare
ce368d3
to
a0e1428
Compare
lib/parity/environment.rb
Outdated
) | ||
end | ||
end | ||
|
||
def branch_ref | ||
main_ref = `find .git/refs/heads/main` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be better to do this using the built-in Git command for finding a ref, just in case the file structure changes later:
# These will be true/false
main_ref_exists = system("git show-ref --verify --quiet refs/heads/master")
master_ref_exists = system("git show-ref --verify --quiet refs/heads/main")
if main_ref_exists && !master_ref_exists
"main"
else
"master"
end
e1cef4d
to
c387eba
Compare
Checks for the presence of refs/heads/main and absence of refs/heads/master; if this condition is true, set ref to "main". If a master ref is present, set ref to "master".
c387eba
to
9fb3c50
Compare
@gabebw This has been sitting for a bit, is it ready to merge? |
@mrjonesbot It looks good to me! I don't have merge permissions on this repo, though, so it's up to someone who does to merge this. Perhaps @geoffharcourt can merge it? |
expect(Kernel).to have_received(:system).with(git_push_feature_branch_main) | ||
end | ||
|
||
it "deploys main production's main for evaluation" do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpick: I think this is "deploys the main branch to production".
Looks great! Thank you for your contribution. |
Resolves #184
Heroku has enabled pushing to main by default in a backwards compatible manner (does not affect master branches): https://devcenter.heroku.com/changelog-items/1829
The change checks for the presence of
main
and the absence ofmaster
-- setting the branch ref appropriately.Avoids manual / global git configs and doesn't break projects where
master
is still the default branch.