Skip to content

add check for author && author.login to avoid errors when author is null#77

Merged
hiimbex merged 2 commits into
masterfrom
bug-fix
Jul 2, 2018
Merged

add check for author && author.login to avoid errors when author is null#77
hiimbex merged 2 commits into
masterfrom
bug-fix

Conversation

@hiimbex
Copy link
Copy Markdown
Contributor

@hiimbex hiimbex commented May 25, 2018

Closes #69 final issues and Sentry Unresolved type error issues.

So this is happening due to commits not being linked to any user, a state which is common for new GitHub accounts/users to be in.

In this state it appears the author field is null and we check in DCO for the author.login (aka your GitHub login), so I've made the check more thorough to avoid this issue.

Signed-off-by: Bex Warner <bexmwarner@gmail.com>
@byron-marohn
Copy link
Copy Markdown

If this does indeed fix #69, I'd sure be happy if this got merged. Thanks in advance!

Copy link
Copy Markdown
Contributor

@bkeepers bkeepers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahhhh, I just ran into a situation similar to this the other day. The challenge is that there's an author field that represents the GitHub author, and a commit.author field that represents the git author data.

I think it'd be great to add a test case for this.

Comment thread lib/dco.js Outdated
const signoffRequired = await isRequiredFor(author.login)
let signoffRequired = true
if (author && author.login) {
signoffRequired = await isRequiredFor(author.login)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this be simplified?

const signoffRequired = !author || await isRequiredFor(author.login)

Signed-off-by: Bex Warner <bexmwarner@gmail.com>
@hiimbex
Copy link
Copy Markdown
Contributor Author

hiimbex commented Jun 14, 2018

Test added!

@hiimbex hiimbex merged commit ff78163 into master Jul 2, 2018
@hiimbex hiimbex deleted the bug-fix branch July 2, 2018 20:11
hiimbex added a commit that referenced this pull request Jul 9, 2018
@hiimbex hiimbex mentioned this pull request Jul 9, 2018
hiimbex added a commit that referenced this pull request Jul 13, 2018
Signed-off-by: Bex Warner <bexmwarner@gmail.com>
hiimbex added a commit that referenced this pull request Jul 14, 2018
Signed-off-by: Bex Warner <bexmwarner@gmail.com>
@github-actions
Copy link
Copy Markdown

🎉 This PR is included in version 1.0.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DCO bot is stuck in "waiting for status reported"

3 participants