add additional fine-grained debugging capabilities
This commit is contained in:
+5
-1
@@ -15,6 +15,10 @@ import {
|
||||
|
||||
|
||||
try {
|
||||
if (isTrueString(core.getBooleanInput('debug_log_github_context'))) {
|
||||
console.log(JSON.stringify(github.context, null, 2));
|
||||
}
|
||||
|
||||
const information = action_information.collect_all(true, false);
|
||||
|
||||
const debug = isTrueString(process.env['ACTIONS_STEP_DEBUG']);
|
||||
@@ -40,7 +44,7 @@ try {
|
||||
}
|
||||
|
||||
const destinations = prepareDestinations(targetRegistries, tags);
|
||||
if (debug) {
|
||||
if (debug || core.getBooleanInput('debug_log_destinations')) {
|
||||
console.log('destinations:', JSON.stringify(destinations, null, 2));
|
||||
}
|
||||
|
||||
|
||||
+23
@@ -61,6 +61,29 @@ export function mergeArgRegistryAuthJson(registryAuthJson) {
|
||||
|
||||
export function writeRegistryAuthJson(registryAuthJson, targetFile) {
|
||||
fs.mkdirSync(path.dirname(targetFile), {recursive: true});
|
||||
const jsonContents = JSON.stringify(registryAuthJson, null, 2);
|
||||
|
||||
// create and log a censored copy if enabled
|
||||
if (core.getBooleanInput('debug_log_auth_json')) {
|
||||
const copy = JSON.parse(jsonContents);
|
||||
for (const registry in copy.auths) {
|
||||
if (copy.auths.hasOwnProperty(registry)) {
|
||||
let credentials = copy.auths[registry].auth;
|
||||
if (credentials != null) {
|
||||
// truncate credentials to avoid leaking sensitive information
|
||||
if (credentials.length > 16) {
|
||||
credentials = credentials.substr(0, 16) + '...';
|
||||
}
|
||||
else {
|
||||
credentials = '***censored***';
|
||||
}
|
||||
copy.auths[registry].auth = credentials;
|
||||
}
|
||||
}
|
||||
}
|
||||
console.log('debug_log_auth_json:', copy);
|
||||
}
|
||||
|
||||
fs.writeFileSync(targetFile, JSON.stringify(registryAuthJson, null, 2));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user