From 2ea7593075334ac970ba7f9040c71b11f6096a60 Mon Sep 17 00:00:00 2001 From: Justin Date: Mon, 23 Mar 2020 18:35:43 -0700 Subject: [PATCH] fix: add debug statements --- .eslintrc.json | 2 +- src/github.ts | 6 ++++++ src/secrets.ts | 5 ++++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index 2ca6332..0c70599 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -42,7 +42,7 @@ "@typescript-eslint/prefer-includes": "error", "@typescript-eslint/prefer-interface": "error", "@typescript-eslint/prefer-string-starts-ends-with": "error", - "@typescript-eslint/promise-function-async": "error", + "@typescript-eslint/promise-function-async": "warn", "@typescript-eslint/require-array-sort-compare": "error", "@typescript-eslint/restrict-plus-operands": "error", "@typescript-eslint/type-annotation-spacing": "error", diff --git a/src/github.ts b/src/github.ts index e8c253d..d801a0a 100644 --- a/src/github.ts +++ b/src/github.ts @@ -69,6 +69,10 @@ export async function listAllMatchingRepos({ per_page }); + core.debug( + `Available repositories: ${JSON.stringify(repos.map(r => r.full_name))}` + ); + return filterReposByPatterns(repos, patterns); } @@ -124,6 +128,8 @@ export async function setSecretsForRepo( for (const k of Object.keys(secrets)) { const encrypted_value = encrypt(secrets[k], publicKey.key); + core.debug(`Set \`${k} = ***\` on ${repo.full_name}`); + if (!dry_run) { await octokit.actions.createOrUpdateSecretForRepo({ owner, diff --git a/src/secrets.ts b/src/secrets.ts index e1407e0..b14e8db 100644 --- a/src/secrets.ts +++ b/src/secrets.ts @@ -26,8 +26,11 @@ export function getSecrets( env: NodeJS.ProcessEnv = process.env ): { [key: string]: string } { const regexPatterns = patterns.map(s => new RegExp(s)); + const keys = Object.keys(env); - return Object.keys(env) + core.debug(`Available env keys: ${JSON.stringify(keys)}`); + + return keys .filter((k: string) => { return env[k] && regexPatterns.filter(r => r.test(k)).length; })