mirror of
https://github.com/esphome/esphome.git
synced 2025-10-25 13:13:48 +01:00
[ci] Add automated memory impact analysis for pull requests (#11242)
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
This commit is contained in:
23
script/ci_helpers.py
Executable file
23
script/ci_helpers.py
Executable file
@@ -0,0 +1,23 @@
|
||||
"""Common helper functions for CI scripts."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
|
||||
|
||||
def write_github_output(outputs: dict[str, str | int]) -> None:
|
||||
"""Write multiple outputs to GITHUB_OUTPUT or stdout.
|
||||
|
||||
When running in GitHub Actions, writes to the GITHUB_OUTPUT file.
|
||||
When running locally, writes to stdout for debugging.
|
||||
|
||||
Args:
|
||||
outputs: Dictionary of key-value pairs to write
|
||||
"""
|
||||
github_output = os.environ.get("GITHUB_OUTPUT")
|
||||
if github_output:
|
||||
with open(github_output, "a", encoding="utf-8") as f:
|
||||
f.writelines(f"{key}={value}\n" for key, value in outputs.items())
|
||||
else:
|
||||
for key, value in outputs.items():
|
||||
print(f"{key}={value}")
|
||||
Reference in New Issue
Block a user