Skip to content

Commit

Permalink
fix: add debug statements
Browse files Browse the repository at this point in the history
  • Loading branch information
jpoehnelt committed Mar 24, 2020
1 parent 566043f commit 2ea7593
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
6 changes: 6 additions & 0 deletions src/github.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down Expand Up @@ -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,
Expand Down
5 changes: 4 additions & 1 deletion src/secrets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
})
Expand Down

0 comments on commit 2ea7593

Please sign in to comment.