MushroomObserver / mushroom-observer

A website for sharing observations of mushrooms.
https://mushroomobserver.org
MIT License
77 stars 25 forks source link

Allow deploy to work when there are no changes to the main branch #2208

Closed mo-nathan closed 3 weeks ago

mo-nathan commented 3 weeks ago

Testing this is change is a bit tricky and kind of self referential. To test it, I created a separate file script/test_deploy.h in my local repo and commented out most of the rest of the script other than this specific logic.

This should let you see if a change on your local on the main branch gets stashed and restored. It should should work with or without other stashed changes.

The other important case is when there is a conflict between what you have locally and what's on the target branch. To test this make sure the check for main at the top of the script is commented out.

Then create a temporary branch that you push to GitHub. In your usual local repo make a change that you don't check in. Make a fresh clone of the GitHub repo in another directory and make a change that conflicts with the one you just made and push that to GitHub. Now run the script from your usual repo. It should fail when it tries to pop the stashed change with a conflict message.

Hopefully that's reasonably clear and paves the way for us to not require that there be differences between the main branch and what's on the server for the files that are managed by git.

nimmolo commented 3 weeks ago

😵‍💫 Trust you on this one...

Curious though, what are the differences between main and what's on production currently? I remember there being some, but i just ran git stash list y no hay nada.

JoeCohen commented 3 weeks ago

@nimmolo AFAIK, the only potential difference is the banner, which is now in sync because @mo-nathan fixed it.

mo-nathan commented 3 weeks ago

Actually at the moment the banner has to be different. Otherwise the deploy script will fail. Hence this PR. At the moemnt:

mo@mushroomobserver:/var/web/mo$ git diff
diff --git a/config/locales/en.txt b/config/locales/en.txt
index 71b746b5a..f65d72b9f 100644
--- a/config/locales/en.txt
+++ b/config/locales/en.txt
@@ -1301,7 +1301,7 @@
   app_title: Mushroom Observer

   # This goes in a box at the top of the page.
-  app_banner_box: "Check out the \"Mushroom Observer Etsy store\":https://www.etsy.com/shop/MushroomObsMerch — T-shirts, bags and swag! <br>\nWe're working on MO. If you have trouble posting, try logging out and logging back in again.<br>\nPlease \"report a bug\":https://mushroomobserver.org/emails/ask_webmaster_question if you find one."
+  app_banner_box: "Checkout \"Project Field Slips\":https://mushroomobserver.org/articles/37!<br>\nPlease \"report a bug\":https://mushroomobserver.org/admin/emails/webmaster_questions/new if you see one."

   # These are the controls/links in the left-hand panel.
   app_intro: Introduction
@@ -1579,7 +1579,6 @@
   form_locations_species_help: List the common, rare, or otherwise interesting species found here.
   form_locations_notes_help: Enter notes that are specific to this particular location.  For example, whether it is private or public, whether permits are required, driving directions, etc.
   form_locations_dubious_help: Submit again to use this location name or edit the text below to correct any typo.
-
   # names/_form_name
   form_names_locked: Lock this name so users cannot change name, author or rank?
   form_names_detailed_help: For detailed help see <a href="https://docs.google.com/document/d/1xOEIAGzb2NoGfeC1QMvVmwtWK-gYyZqKkt7yKv61WY0" target="_new">Names in Mushroom Observer</a>.