Skip to content

Commit f62c919

Browse files
Added a flag to configure behavior for hooks status return.
1 parent 6dfd999 commit f62c919

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

config.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
22
"github_ips_only": false,
33
"enforce_secret": "",
4+
"return_scripts_info": true
45
}

webhooks.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ def index():
9898
]
9999

100100
# Run scripts
101+
silent = config.get(return_scripts_info, False)
101102
ran = {}
102103
for s in scripts:
103104
if isfile(s) and access(s, X_OK):
@@ -107,11 +108,13 @@ def index():
107108
stdout=PIPE, stderr=PIPE
108109
)
109110
stdout, stderr = cmd.communicate()
110-
ran[basename(s)] = {
111-
'returncode': returncode,
112-
'stdout': stdout,
113-
'stderr': stderr,
114-
}
111+
112+
if not silent:
113+
ran[basename(s)] = {
114+
'returncode': cmd.returncode,
115+
'stdout': stdout,
116+
'stderr': stderr,
117+
}
115118

116119
return ran
117120

0 commit comments

Comments
 (0)