Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions lib/dco.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@ module.exports = async function (commits, isRequiredFor) {

for (const {commit, author, parents} of commits) {
const isMerge = parents && parents.length > 1
const signoffRequired = await isRequiredFor(author.login)
if (isMerge || author.type === 'Bot' || (!signoffRequired && commit.verification.verified)) {
const signoffRequired = !author || await isRequiredFor(author.login)
if (isMerge || (!signoffRequired && commit.verification.verified)) {
continue
} else if (!author || author.type === 'Bot') {
continue
}
const match = regex.exec(commit.message)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"devDependencies": {
"eslint-plugin-import": "^2.11.0",
"jest": "^22.4.3",
"nock": "^9.2.5",
"nock": "^9.2.6",
"smee-client": "^1.0.1",
"standard": "^11.0.0"
},
Expand Down
21 changes: 21 additions & 0 deletions test/dco.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -406,4 +406,25 @@ describe('dco', () => {
expect(JSON.stringify(dcoObject)).toBe(success)
}
)

test(
'returns success if author does not exist but everything else is ok',
async () => {
const commit = {
message: 'What a nice day!\n\nSigned-off-by: Bex Warner <bexmwarner@gmail.com>',
author: {
name: 'Bexo',
email: 'bexo@gmail.com'
},
committer: {
name: 'Bex Warner',
email: 'bexmwarner@gmail.com'
}
}
const author = null
const dcoObject = await getDCOStatus([{commit, author, parents: []}], alwaysRequireSignoff)

expect(JSON.stringify(dcoObject)).toBe(success)
}
)
})