Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correct Dangerfile to account for commits which aren't tied to a GitHub user. #3502

Merged
merged 2 commits into from
May 23, 2018

Conversation

abernix
Copy link
Member

@abernix abernix commented May 23, 2018

From my commit message on 5d3889c:


As demonstrated in the Danger test0 on #3444, the author property is not always set. While it could make sense to individually look at each individual commit's "login", Git commits are not always tied to GitHub users so it seems more relevant to look at the GitHub login of the user (or bot!) opening the PR, when making decisions about whether to apply bot-only policies.

Some of these were already defined higher up, so it's worth using their
shorter notations!
…defined.

As demonstrated in the Danger test[0] on #3444,
the `author` property is not always set.  While it could make sense to
individually look at each individual commit's "login", Git commits are not
always tied to GitHub users so it seems more relevant to look at the GitHub
login of the user (or bot!) opening the PR, when making decisions about
whether to apply bot-only policies.

[0]: https://circleci.com/gh/apollographql/apollo-client/8427
Copy link
Member

@hwillson hwillson left a comment

Choose a reason for hiding this comment

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

Looks great @abernix - LGTM!

@@ -57,8 +58,17 @@ const raiseIssueAboutPaths = (
}
};

const authors = commits.map(x => x.author.login);
const isBot = authors.some(x => ['greenkeeper', 'renovate'].indexOf(x) > -1);
console.log("GitHub PR Username:", pr && pr.user && pr.user.login);
Copy link
Member

Choose a reason for hiding this comment

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

When you console.log from a danger file, does it show up anywhere?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yup! In the CircleCI output for the Danger script host. On this PR, that's in ci/circleci: Danger.

Copy link
Member

Choose a reason for hiding this comment

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

Ah, makes sense - thanks @abernix!

@abernix abernix merged commit 034f00d into master May 23, 2018
@abernix abernix deleted the abernix/fix-danger-login branch May 23, 2018 11:25
abernix added a commit that referenced this pull request May 23, 2018
I wasn't able to actually determine what the correct username was until
Renovate triggered one of the PRs based on #3502.

Follows-up on #3502.
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 17, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants