Open niodice opened 4 months ago
Yes, we should definitely do that. Pull request welcome! Please add a test or update one of the existing ones 🙏
Should trailing commas be trimmed as well? Seems these lines needs to be changed https://github.com/actions/create-github-app-token/blob/c8f55efbd427e7465d6da1106e7979bc8aaee856/lib/main.js#L147 https://github.com/actions/create-github-app-token/blob/c8f55efbd427e7465d6da1106e7979bc8aaee856/lib/main.js#L157
For just spaces
'a, b,c , d'.split(/\s*,\s*/)
With trailing commas:
'a, b,c , d,'.replace(/,\s*$/,'').split(/\s*,\s*/)
This action could handle a little more flexibility in the
repositories
input. A common mistake is to providerepositories: foo, bar
instead ofrepositories: foo,bar
if a token is needed for > 1 repository.For example:
Fails to get a token because the body in the HTTP request to GH will look like this:
I think trimming the repos, something like
repos = repos.map(r => r.trim())
, would catch this and make for a more intuitive API