Skip to content

Commit

Permalink
handle 1MB outputs
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Long committed Mar 8, 2024
1 parent b6b2596 commit 9c47124
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion entrypoint/entrypoint/orchestrator.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import sys

from entrypoint import installer
from entrypoint import executor

Expand All @@ -24,7 +26,14 @@ def compress_encode_file(file):

def set_github_output(key, value):
if os.getenv('GITHUB_ACTIONS') == 'true':
return os.system(f'echo "{key}=test123" >> "$GITHUB_OUTPUT"')
size_in_mb = (sys.getsizeof(value)) / (1024 * 1024)
if size_in_mb > 1:
s = f"unable to set output '{key}' because it is larger than GitHub's maximum allowed file size (1MB); actual size: {size_in_mb}"
logging.warning(s)
compressed_contents = zlib.compress(s.encode())
encoded = base64.b64encode(compressed_contents).decode()
value = encoded
return os.system(f'echo "{key}={value}" >> "$GITHUB_OUTPUT"')
else:
return 0

Expand Down

0 comments on commit 9c47124

Please sign in to comment.