A context manager that outputs a log marker around a section of a build. If running in a GitHub Actions environment, the GitHub syntax for collapsible log sections is used.
(text: str)
| 221 | |
| 222 | @contextmanager |
| 223 | def group(text: str): |
| 224 | """A context manager that outputs a log marker around a section of a build. |
| 225 | |
| 226 | If running in a GitHub Actions environment, the GitHub syntax for |
| 227 | collapsible log sections is used. |
| 228 | """ |
| 229 | if "GITHUB_ACTIONS" in os.environ: |
| 230 | print(f"::group::{text}") |
| 231 | else: |
| 232 | print(f"===== {text} " + "=" * (70 - len(text))) |
| 233 | |
| 234 | yield |
| 235 | |
| 236 | if "GITHUB_ACTIONS" in os.environ: |
| 237 | print("::endgroup::") |
| 238 | else: |
| 239 | print() |
| 240 | |
| 241 | |
| 242 | @contextmanager |
no outgoing calls
no test coverage detected
searching dependent graphs…