feat: allow repositories input to be comma or newline-separated (#169)

Resolves https://github.com/actions/create-github-app-token/issues/106

- Fixes the parsing to cope with whitespace in the input string.
- Allows the input to be comma or newline-separated. (I've done this for
all array-type inputs in my own actions, but I'm happy to remove this if
you only want to support comma-separated.)
- Added tests for parsing comma and newline-separated inputs.
This commit is contained in:
Peter Evans
2024-09-11 21:54:50 +01:00
committed by GitHub
parent 3378cda945
commit 796b88dc58
10 changed files with 75 additions and 37 deletions

View File

@@ -25,7 +25,10 @@ if (!privateKey) {
throw new Error("Input required and not supplied: private-key");
}
const owner = core.getInput("owner");
const repositories = core.getInput("repositories");
const repositories = core.getInput("repositories")
.split(/[\n,]+/)
.map(s => s.trim())
.filter(x => x !== '');
const skipTokenRevoke = Boolean(
core.getInput("skip-token-revoke") || core.getInput("skip_token_revoke")