Skip to content

Commit

Permalink
pyHDLC/run: print block titles as GHA step summary
Browse files Browse the repository at this point in the history
  • Loading branch information
umarcor committed May 24, 2023
1 parent d3c298b commit 3b92d0c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/common.yml
Expand Up @@ -100,5 +100,3 @@ jobs:
architecture: ${{ matrix.arch }}
collection: ${{ matrix.os }}
images: ${{ matrix.imgs }}

- run: echo '### Bye! :rocket:' >> $GITHUB_STEP_SUMMARY
11 changes: 7 additions & 4 deletions utils/pyHDLC/run.py
Expand Up @@ -17,7 +17,7 @@
#
# SPDX-License-Identifier: Apache-2.0

from typing import List, Optional
from typing import List
from pathlib import Path
from sys import executable, platform, stdout as sys_stdout, stderr as sys_stderr
from os import environ
Expand All @@ -32,14 +32,17 @@
shell: List[str] = [which("bash")] if platform == "win32" else []


def _exec(args: List[str], dry: Optional[bool] = False, collapse: Optional[str] = None):
def _exec(args: List[str], dry: bool = False, collapse: str = None):
isGroup = isGHA and collapse is not None

if isGroup:
print(f"\n::group::{collapse}")
sys_stdout.flush()
sys_stderr.flush()

if isGroup:
GHASummary([f"- {collapse}"])

print("·", " ".join(args))
sys_stdout.flush()
sys_stderr.flush()
Expand All @@ -53,11 +56,11 @@ def _exec(args: List[str], dry: Optional[bool] = False, collapse: Optional[str]
sys_stderr.flush()


def _sh(args: List[str], dry: Optional[bool] = False):
def _sh(args: List[str], dry: bool = False):
_exec(shell + args, dry=dry)


def _py(args: List[str], dry: Optional[bool] = False):
def _py(args: List[str], dry: bool = False):
_exec([executable] + args, dry=dry)


Expand Down

0 comments on commit 3b92d0c

Please sign in to comment.