Retain spaces within label (#95)

This commit is contained in:
Pavish Kumar
2021-10-08 17:47:46 +05:30
committed by GitHub
parent b279a61c36
commit 9e9a90b41e
3 changed files with 16 additions and 2 deletions

View File

@@ -41,6 +41,20 @@ describe('getIssueOption', () => {
}
expect(issue.getIssueOption('hi')).toEqual(expected)
})
test('with label containing spaces', () => {
process.env.INPUT_ISSUE_TITLE = 'npm audit found vulnerabilities'
process.env.INPUT_ISSUE_ASSIGNEES = 'alice'
process.env.INPUT_ISSUE_LABELS = 'status: ready, work: frontend'
const expected: IssueOption = {
title: 'npm audit found vulnerabilities',
body: 'hi',
assignees: ['alice'],
labels: ['status: ready', 'work: frontend']
}
expect(issue.getIssueOption('hi')).toEqual(expected)
})
})
describe('getExistingIssueNumber', () => {

2
dist/index.js vendored
View File

@@ -104,7 +104,7 @@ function getIssueOption(body) {
assignees = core.getInput('issue_assignees').replace(/\s+/g, '').split(',');
}
if (core.getInput('issue_labels')) {
labels = core.getInput('issue_labels').replace(/\s+/g, '').split(',');
labels = core.getInput('issue_labels').split(',').map(label => label.trim());
}
return {
title: core.getInput('issue_title'),

View File

@@ -9,7 +9,7 @@ export function getIssueOption(body: string): IssueOption {
assignees = core.getInput('issue_assignees').replace(/\s+/g, '').split(',')
}
if (core.getInput('issue_labels')) {
labels = core.getInput('issue_labels').replace(/\s+/g, '').split(',')
labels = core.getInput('issue_labels').split(',').map(label => label.trim())
}
return {