Skip to content

Commit 34d4f07

Browse files
committed
Enable debugging also if ACTIONS_STEP_DEBUG==true
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 <[email protected]>
1 parent f514d46 commit 34d4f07

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

action.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@
3737
_SUMMARY = Path(_summary_path).open("a")
3838

3939
_RENDER_SUMMARY = os.getenv("GHA_SIGSTORE_PYTHON_SUMMARY", "true") == "true"
40-
_DEBUG = os.getenv("GHA_SIGSTORE_PYTHON_INTERNAL_BE_CAREFUL_DEBUG", "false") != "false"
40+
_INTERNAL_DEBUG = os.getenv("GHA_SIGSTORE_PYTHON_INTERNAL_BE_CAREFUL_DEBUG", "false") != "false"
41+
_GHA_STEP_DEBUG = os.getenv("ACTIONS_STEP_DEBUG", "false") == "true"
4142

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

5758

5859
def _debug(msg):
59-
if _DEBUG:
60+
if _INTERNAL_DEBUG:
6061
print(f"\033[93mDEBUG: {msg}\033[0m", file=sys.stderr)
62+
elif _GHA_STEP_DEBUG:
63+
print(f"::debug::{msg}", file=sys.stderr)
6164

6265

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

134-
if _DEBUG:
137+
if _INTERNAL_DEBUG or _GHA_STEP_DEBUG:
135138
sigstore_python_env["SIGSTORE_LOGLEVEL"] = "DEBUG"
136139

137140
identity_token = os.getenv("GHA_SIGSTORE_PYTHON_IDENTITY_TOKEN")

setup/setup.bash

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,10 @@ die() {
2222
}
2323

2424
debug() {
25-
if [[ "${GHA_SIGSTORE_PYTHON_INTERNAL_BE_CAREFUL_DEBUG}" = "true" ]]; then
26-
echo -e "\033[93mDEBUG: ${1}\033[0m"
25+
if [[ "${GHA_SIGSTORE_PYTHON_INTERNAL_BE_CAREFUL_DEBUG}" == "true" ]]; then
26+
echo -e "\033[93mDEBUG: ${1}\033[0m" >&2
27+
elif [[ "${ACTIONS_STEP_DEBUG}" == 'true' ]]; then
28+
echo "::debug::${*}" >&2
2729
fi
2830
}
2931

0 commit comments

Comments
 (0)