Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
gidjin committed Apr 5, 2023
1 parent ad23e9a commit 472c975
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions dangerfile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as child from 'child_process'

import { danger, fail, schedule, warn } from 'danger'

const shouldRun = !danger.github || (danger.github && danger.github.pr.user.type !== 'Bot');
//const shouldRun = danger.github?.pr?.user?.type !== 'Bot';

// Load all modified and new files
const allFiles = danger.git.modified_files.concat(danger.git.created_files)
Expand Down Expand Up @@ -55,7 +55,7 @@ const checkYarnAudit: () => void = () => {

const checkPrDescription: () => void = () => {
// No PR is too small to include a description of why you made a change
if (danger.github && danger.github.pr.body.length < 10) {
if (danger.github?.pr?.body?.length < 10) {
warn('Please include a description of your PR changes.')
}
}
Expand Down Expand Up @@ -130,7 +130,7 @@ const checkDependencyChanges: () => void = () => {

// Check for any changes to the contributors section of package.json
schedule(async () => {
if (!shouldRun) {
if (!danger.git) {
return;
}
const pd = await danger.git.JSONDiffForFile('package.json')
Expand All @@ -144,12 +144,8 @@ schedule(async () => {
}
})

// skip these checks if PR is by any bot (e.g. dependabot), if we
// don't have a github object let it run also since we are local
if (shouldRun) {
checkYarnAudit()
checkPrDescription()
checkYarnAudit()
checkPrDescription()

checkCodeChanges()
checkDependencyChanges()
}
checkCodeChanges()
checkDependencyChanges()

0 comments on commit 472c975

Please sign in to comment.