Skip to content

Commit b4c1e39

Browse files
committed
debug mode for GH action
1 parent 5b2d7d7 commit b4c1e39

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

action.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ inputs:
88
description: 'Arguments to pass to the Dockerfile entrypoint.'
99
required: true
1010
default: '--help'
11+
debug:
12+
description: 'Whether to enable debug mode.'
13+
required: false
14+
default: 'false'
1115
outputs:
1216
command:
1317
description: 'The command that was executed.'
@@ -18,7 +22,8 @@ outputs:
1822
runs:
1923
using: 'docker'
2024
image: 'Dockerfile'
21-
#env:
25+
env:
26+
DEBUG: ${{ inputs.debug }}
2227
# GITHUB_TOKEN is already available in the action container context
2328
# but be sure that it has 'writer' permissions on the target repository.
2429
args:

entrypoint.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,13 @@ if [ -z "$GITHUB_TOKEN" ]; then
77
exit 1
88
fi
99

10+
if [[ "$DEBUG" == "true" ]]; then
11+
echo "first arg"
12+
echo $1
13+
echo "all args:"
14+
echo $@
15+
fi
16+
1017
argv=(node /app/github.js "$@")
1118
cmd=$(printf '%q ' "${argv[@]}")
1219
eval $cmd

src/log.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ const error = (...args) => {
4545
};
4646

4747
const debug = (...args) => {
48-
if (!!process.env.DEBUG) {
48+
if (!!process.env.DEBUG && process.env.DEBUG === "true") {
4949
const prefix = getPrefix("DEBUG");
5050
console.log(prefix, ...args);
5151
}

0 commit comments

Comments
 (0)