Handle empty "labeled" key

This commit is contained in:
Jonathan Clem
2022-01-31 15:44:24 -05:00
parent 3a482bf2c7
commit f3decd19c0
3 changed files with 19 additions and 10 deletions

View File

@@ -31,7 +31,12 @@ interface ProjectAddItemResponse {
async function run(): Promise<void> {
const projectUrl = core.getInput('project-url', {required: true})
const ghToken = core.getInput('github-token', {required: true})
const labeled = core.getInput('labeled')?.split(',') ?? []
const labeled =
core
.getInput('labeled')
.split(',')
.map(l => l.trim())
.filter(l => l.length > 0) ?? []
const octokit = github.getOctokit(ghToken)
const urlMatch = projectUrl.match(urlParse)
const issue = github.context.payload.issue ?? github.context.payload.pull_request