Skip to content

Commit

Permalink
Enable debugging also if ACTIONS_STEP_DEBUG==true
Browse files Browse the repository at this point in the history
ACTIONS_STEP_DEBUG is a standard GitHub Actions flag to
enable debugging output across all actions and workflows.

See: https://docs.github.com/en/actions/monitoring-and-troubleshooting-workflows/troubleshooting-workflows/enabling-debug-logging#enabling-step-debug-logging

Signed-off-by: Jan Chren ~rindeal <dev.rindeal@gmail.com>
  • Loading branch information
rindeal committed Aug 4, 2024
1 parent f514d46 commit 34d4f07
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
9 changes: 6 additions & 3 deletions action.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@
_SUMMARY = Path(_summary_path).open("a")

_RENDER_SUMMARY = os.getenv("GHA_SIGSTORE_PYTHON_SUMMARY", "true") == "true"
_DEBUG = os.getenv("GHA_SIGSTORE_PYTHON_INTERNAL_BE_CAREFUL_DEBUG", "false") != "false"
_INTERNAL_DEBUG = os.getenv("GHA_SIGSTORE_PYTHON_INTERNAL_BE_CAREFUL_DEBUG", "false") != "false"
_GHA_STEP_DEBUG = os.getenv("ACTIONS_STEP_DEBUG", "false") == "true"

_RELEASE_SIGNING_ARTIFACTS = (
os.getenv("GHA_SIGSTORE_PYTHON_RELEASE_SIGNING_ARTIFACTS", "true") == "true"
Expand All @@ -56,8 +57,10 @@ def _summary(msg):


def _debug(msg):
if _DEBUG:
if _INTERNAL_DEBUG:
print(f"\033[93mDEBUG: {msg}\033[0m", file=sys.stderr)
elif _GHA_STEP_DEBUG:
print(f"::debug::{msg}", file=sys.stderr)


def _log(msg):
Expand Down Expand Up @@ -131,7 +134,7 @@ def _fatal_help(msg):
# to upload these as workflow artifacts after signing.
signing_artifact_paths = []

if _DEBUG:
if _INTERNAL_DEBUG or _GHA_STEP_DEBUG:
sigstore_python_env["SIGSTORE_LOGLEVEL"] = "DEBUG"

identity_token = os.getenv("GHA_SIGSTORE_PYTHON_IDENTITY_TOKEN")
Expand Down
6 changes: 4 additions & 2 deletions setup/setup.bash
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@ die() {
}

debug() {
if [[ "${GHA_SIGSTORE_PYTHON_INTERNAL_BE_CAREFUL_DEBUG}" = "true" ]]; then
echo -e "\033[93mDEBUG: ${1}\033[0m"
if [[ "${GHA_SIGSTORE_PYTHON_INTERNAL_BE_CAREFUL_DEBUG}" == "true" ]]; then
echo -e "\033[93mDEBUG: ${1}\033[0m" >&2
elif [[ "${ACTIONS_STEP_DEBUG}" == 'true' ]]; then
echo "::debug::${*}" >&2
fi
}

Expand Down

0 comments on commit 34d4f07

Please sign in to comment.