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

feat(danger): Block PR if yarn audit has high or critical, do not run on dependabot, no warn on version #327

Merged
merged 7 commits into from
Jul 23, 2020

Conversation

ahobson
Copy link
Contributor

@ahobson ahobson commented Jul 16, 2020

Summary

Update danger config to run yarn audit and block if high or critical issues are found.
Do not run danger on dependabot PRs
Do not warn if the only changes the package.json is the version

Related Issues or PRs

closes #324

How To Test

Screenshots (optional)

@ahobson ahobson force-pushed the feat-dangerjs-block-yarn-audit-324 branch 2 times, most recently from 3f14225 to aec57bc Compare July 22, 2020 15:52
@trussworks-infra-zz
Copy link

trussworks-infra-zz commented Jul 22, 2020

Warnings
⚠️

Changes were made to package.json, but not to yarn.lock - Perhaps you need to run yarn install?

Generated by 🚫 dangerJS against c1b511b

@ahobson ahobson changed the title WIP: feat(danger): Block PR if yarn audit has high or critical feat(danger): Block PR if yarn audit has high or critical, do not run on dependabot, no warn on version Jul 22, 2020
Copy link
Contributor

@haworku haworku left a comment

Choose a reason for hiding this comment

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

A couple questions inline.

Also could you update contributing.md dev notes - we list the actions that danger takes so this needs to be slightly adjusted (for what happens withyarn audit).

Otherwise looks good!

dangerfile.ts Outdated
// skip these checks if PR is by dependabot, if we don't have a github object let it run also since we are local
if (
!danger.github ||
(danger.github && danger.github.pr.user.login !== 'dependabot-preview[bot]')
Copy link
Contributor

Choose a reason for hiding this comment

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

In other places (circleci config) we check for 'dependabot-preview[bot]' and `dependabot[bot]' . Assuming that's no longer needed? Just checking

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure. I'll try to check

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think I found a way to detect all bots, so I think that will do what we want

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for looking for into it 🚀

@@ -129,7 +129,7 @@
"husky": {
"hooks": {
"pre-commit": "tsc --noEmit && lint-staged",
"pre-push": "yarn danger local --failOnErrors"
"pre-push": "yarn danger local -b main --failOnErrors"
Copy link
Contributor

Choose a reason for hiding this comment

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

is running yarn danger local -b main --failOnErrors locally supposed to work for me at this point?

I'm getting the Error: fatal: ambiguous argument 'master...HEAD': unknown revision or path not in the working tree. error

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, there hasn't been any more feedback on my bug report. Maybe I'll just open a PR

@ahobson ahobson requested a review from haworku July 23, 2020 13:32
haworku
haworku previously approved these changes Jul 23, 2020
@ahobson ahobson force-pushed the feat-dangerjs-block-yarn-audit-324 branch from 8e57aef to c1b511b Compare July 23, 2020 15:34
@ahobson ahobson merged commit ee13281 into main Jul 23, 2020
@ahobson ahobson deleted the feat-dangerjs-block-yarn-audit-324 branch July 23, 2020 22:39
@ahobson ahobson mentioned this pull request Jul 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[feat] danger should block PRs if yarn audit finds high or critical issues
3 participants