From 764ff7203c4f12e6c0a3fd811a41f56c15cd1a6d Mon Sep 17 00:00:00 2001 From: tooomm Date: Mon, 24 Jan 2022 14:44:42 +0100 Subject: [PATCH 01/14] Update __main__.py --- magic_spoiler/__main__.py | 1 + 1 file changed, 1 insertion(+) diff --git a/magic_spoiler/__main__.py b/magic_spoiler/__main__.py index 9c2474a3..b8ed8c19 100644 --- a/magic_spoiler/__main__.py +++ b/magic_spoiler/__main__.py @@ -648,6 +648,7 @@ def main() -> None: print("::set-output name=deploy::true") else: print("::set-output name=deploy::false") + print("::notice:: No new spoilers found") if __name__ == "__main__": From 47c3b439634a806ab96f8b0a9bae40837b6e5bd9 Mon Sep 17 00:00:00 2001 From: tooomm Date: Mon, 24 Jan 2022 14:48:05 +0100 Subject: [PATCH 02/14] Update __main__.py --- magic_spoiler/__main__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/magic_spoiler/__main__.py b/magic_spoiler/__main__.py index b8ed8c19..75636a50 100644 --- a/magic_spoiler/__main__.py +++ b/magic_spoiler/__main__.py @@ -412,7 +412,7 @@ def write_spoilers_xml(trice_dicts: Dict[str, List[Dict[str, Any]]]) -> bool: return False # Move new version to old location - print("Changes detected, replacing spoiler.xml with updated version") + print("::notice::Changes detected, replacing spoiler.xml with updated version") shutil.move(card_xml_file.name, old_xml_location) return True From bcfb1038c771c13a269aa2c9b32ca4df0b45e4b5 Mon Sep 17 00:00:00 2001 From: tooomm Date: Mon, 24 Jan 2022 15:00:05 +0100 Subject: [PATCH 03/14] Update __main__.py --- magic_spoiler/__main__.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/magic_spoiler/__main__.py b/magic_spoiler/__main__.py index 75636a50..0ab27bae 100644 --- a/magic_spoiler/__main__.py +++ b/magic_spoiler/__main__.py @@ -408,7 +408,7 @@ def write_spoilers_xml(trice_dicts: Dict[str, List[Dict[str, Any]]]) -> bool: old_xml_location = str(OUTPUT_DIR.joinpath(output_file_name)) if compare_xml_content(card_xml_file.name, old_xml_location): - print("No new data in spoiler.xml, skipping replacement") + print("::notice::No new data in spoiler.xml, skipping replacement") return False # Move new version to old location @@ -646,9 +646,10 @@ def main() -> None: # Set output to deploy if changed: print("::set-output name=deploy::true") + print("::notice title=Updates available::New spoiler files will be uploaded") else: print("::set-output name=deploy::false") - print("::notice:: No new spoilers found") + print("::notice title=No updates available::There are no new spoiler cards") if __name__ == "__main__": From 8bceceae6e6de87759eb74816be8b746e8217281 Mon Sep 17 00:00:00 2001 From: tooomm Date: Mon, 24 Jan 2022 15:09:11 +0100 Subject: [PATCH 04/14] Update __main__.py --- magic_spoiler/__main__.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/magic_spoiler/__main__.py b/magic_spoiler/__main__.py index 0ab27bae..243f7bf3 100644 --- a/magic_spoiler/__main__.py +++ b/magic_spoiler/__main__.py @@ -408,11 +408,11 @@ def write_spoilers_xml(trice_dicts: Dict[str, List[Dict[str, Any]]]) -> bool: old_xml_location = str(OUTPUT_DIR.joinpath(output_file_name)) if compare_xml_content(card_xml_file.name, old_xml_location): - print("::notice::No new data in spoiler.xml, skipping replacement") + print("No new data in spoiler.xml, skipping replacement") return False # Move new version to old location - print("::notice::Changes detected, replacing spoiler.xml with updated version") + print("Changes detected, replacing spoiler.xml with updated version") shutil.move(card_xml_file.name, old_xml_location) return True @@ -644,13 +644,13 @@ def main() -> None: changed |= delete_old_files() # Set output to deploy - if changed: - print("::set-output name=deploy::true") - print("::notice title=Updates available::New spoiler files will be uploaded") - else: - print("::set-output name=deploy::false") - print("::notice title=No updates available::There are no new spoiler cards") - + if CI == true: + if changed: + print("::set-output name=deploy::true") + print("::notice title=Updates available::New spoiler files will be uploaded") + else: + print("::set-output name=deploy::false") + print("::notice title=No updates available::There are no new spoiler cards") if __name__ == "__main__": main() From 929a04c9151f026bfb7fe0b70afb189eef0191c2 Mon Sep 17 00:00:00 2001 From: tooomm Date: Mon, 24 Jan 2022 15:14:30 +0100 Subject: [PATCH 05/14] Update __main__.py --- magic_spoiler/__main__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/magic_spoiler/__main__.py b/magic_spoiler/__main__.py index 243f7bf3..d4862afb 100644 --- a/magic_spoiler/__main__.py +++ b/magic_spoiler/__main__.py @@ -644,7 +644,7 @@ def main() -> None: changed |= delete_old_files() # Set output to deploy - if CI == true: + if os.getenv('CI'): if changed: print("::set-output name=deploy::true") print("::notice title=Updates available::New spoiler files will be uploaded") From ef0ced8d690f05a2101c4be1042647f5cc2ee845 Mon Sep 17 00:00:00 2001 From: tooomm Date: Mon, 24 Jan 2022 15:27:22 +0100 Subject: [PATCH 06/14] Update __main__.py --- magic_spoiler/__main__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/magic_spoiler/__main__.py b/magic_spoiler/__main__.py index d4862afb..4f35eea0 100644 --- a/magic_spoiler/__main__.py +++ b/magic_spoiler/__main__.py @@ -644,7 +644,7 @@ def main() -> None: changed |= delete_old_files() # Set output to deploy - if os.getenv('CI'): + if os.environ('CI'): if changed: print("::set-output name=deploy::true") print("::notice title=Updates available::New spoiler files will be uploaded") From 1adfed5fc6237e814f0a4f6066a855faed98fa29 Mon Sep 17 00:00:00 2001 From: tooomm Date: Mon, 24 Jan 2022 15:35:56 +0100 Subject: [PATCH 07/14] Update __main__.py --- magic_spoiler/__main__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/magic_spoiler/__main__.py b/magic_spoiler/__main__.py index 4f35eea0..243f7bf3 100644 --- a/magic_spoiler/__main__.py +++ b/magic_spoiler/__main__.py @@ -644,7 +644,7 @@ def main() -> None: changed |= delete_old_files() # Set output to deploy - if os.environ('CI'): + if CI == true: if changed: print("::set-output name=deploy::true") print("::notice title=Updates available::New spoiler files will be uploaded") From d54f4127930b24848a46d7096c36962c3e8f44fd Mon Sep 17 00:00:00 2001 From: tooomm Date: Mon, 24 Jan 2022 15:38:34 +0100 Subject: [PATCH 08/14] Update __main__.py --- magic_spoiler/__main__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/magic_spoiler/__main__.py b/magic_spoiler/__main__.py index 243f7bf3..5da6985f 100644 --- a/magic_spoiler/__main__.py +++ b/magic_spoiler/__main__.py @@ -5,6 +5,7 @@ import contextvars import datetime import hashlib import json +import os import pathlib import shutil import time @@ -644,7 +645,7 @@ def main() -> None: changed |= delete_old_files() # Set output to deploy - if CI == true: + if os.environ('CI'): if changed: print("::set-output name=deploy::true") print("::notice title=Updates available::New spoiler files will be uploaded") From 8afb4cee34f6c7e966995f5892cb5ed6ff022172 Mon Sep 17 00:00:00 2001 From: tooomm Date: Mon, 24 Jan 2022 15:43:55 +0100 Subject: [PATCH 09/14] Update __main__.py --- magic_spoiler/__main__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/magic_spoiler/__main__.py b/magic_spoiler/__main__.py index 5da6985f..76153c58 100644 --- a/magic_spoiler/__main__.py +++ b/magic_spoiler/__main__.py @@ -645,7 +645,7 @@ def main() -> None: changed |= delete_old_files() # Set output to deploy - if os.environ('CI'): + if os.environ['CI']: if changed: print("::set-output name=deploy::true") print("::notice title=Updates available::New spoiler files will be uploaded") From b6b518b1d94cd4f4d24575fb248946f92319c34e Mon Sep 17 00:00:00 2001 From: tooomm Date: Fri, 4 Feb 2022 15:09:17 +0100 Subject: [PATCH 10/14] title --- .github/workflows/deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 254b5c50..e6adb40e 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -75,4 +75,4 @@ jobs: git commit -m "Deploy: $GITHUB_SHA" git push deploy_commit=`git rev-parse HEAD` - echo ::notice::"See deployment: $GITHUB_SERVER_URL/$GITHUB_REPOSITORY/commit/$deploy_commit" + echo ::notice title=New data uploaded::"See deployment: $GITHUB_SERVER_URL/$GITHUB_REPOSITORY/commit/$deploy_commit" From 13023af7802d0e65210abbaf3b6c1e91b8ecfc18 Mon Sep 17 00:00:00 2001 From: tooomm Date: Fri, 4 Feb 2022 15:17:32 +0100 Subject: [PATCH 11/14] wording --- magic_spoiler/__main__.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/magic_spoiler/__main__.py b/magic_spoiler/__main__.py index 76153c58..c4f9fe31 100644 --- a/magic_spoiler/__main__.py +++ b/magic_spoiler/__main__.py @@ -648,10 +648,9 @@ def main() -> None: if os.environ['CI']: if changed: print("::set-output name=deploy::true") - print("::notice title=Updates available::New spoiler files will be uploaded") else: print("::set-output name=deploy::false") - print("::notice title=No updates available::There are no new spoiler cards") + print("::notice title=No updates available::No new spoiler cards found for deployment") if __name__ == "__main__": main() From d234a9ccef7e2add17997471d0421264829d777f Mon Sep 17 00:00:00 2001 From: tooomm Date: Fri, 4 Feb 2022 15:19:15 +0100 Subject: [PATCH 12/14] Update __main__.py --- magic_spoiler/__main__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/magic_spoiler/__main__.py b/magic_spoiler/__main__.py index c4f9fe31..923d4427 100644 --- a/magic_spoiler/__main__.py +++ b/magic_spoiler/__main__.py @@ -644,7 +644,7 @@ def main() -> None: # Cleanup outdated stuff that's not necessary changed |= delete_old_files() - # Set output to deploy + # Only when run in CI, enable deployment on changes if os.environ['CI']: if changed: print("::set-output name=deploy::true") From a33e90021b949012e0823e9d196176122fe250fb Mon Sep 17 00:00:00 2001 From: tooomm Date: Fri, 4 Feb 2022 16:54:35 +0100 Subject: [PATCH 13/14] cleanup --- magic_spoiler/__main__.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/magic_spoiler/__main__.py b/magic_spoiler/__main__.py index 923d4427..50de81ac 100644 --- a/magic_spoiler/__main__.py +++ b/magic_spoiler/__main__.py @@ -5,7 +5,6 @@ import contextvars import datetime import hashlib import json -import os import pathlib import shutil import time @@ -644,13 +643,12 @@ def main() -> None: # Cleanup outdated stuff that's not necessary changed |= delete_old_files() - # Only when run in CI, enable deployment on changes - if os.environ['CI']: - if changed: - print("::set-output name=deploy::true") - else: - print("::set-output name=deploy::false") - print("::notice title=No updates available::No new spoiler cards found for deployment") + # Enable deployment on changes (used in CI) + if changed: + print("::set-output name=deploy::true") + else: + print("::set-output name=deploy::false") + print("::notice title=No updates available::No new spoiler cards found for deployment") if __name__ == "__main__": main() From 5e6d9ad5f77a5288aac00977d25c4d27c7bbdf58 Mon Sep 17 00:00:00 2001 From: ebbit1q Date: Fri, 4 Feb 2022 23:56:11 +0100 Subject: [PATCH 14/14] Update magic_spoiler/__main__.py --- magic_spoiler/__main__.py | 1 + 1 file changed, 1 insertion(+) diff --git a/magic_spoiler/__main__.py b/magic_spoiler/__main__.py index 50de81ac..ff32a358 100644 --- a/magic_spoiler/__main__.py +++ b/magic_spoiler/__main__.py @@ -650,5 +650,6 @@ def main() -> None: print("::set-output name=deploy::false") print("::notice title=No updates available::No new spoiler cards found for deployment") + if __name__ == "__main__": main()