Skip to content

Commit

Permalink
experimental fix for danger errors on push
Browse files Browse the repository at this point in the history
  • Loading branch information
jpandersen87 committed Feb 3, 2024
1 parent e1931c2 commit 2f2ed1e
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions dangerfile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ 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 || (danger.github && 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 @@ -45,7 +46,7 @@ const checkYarnAudit: () => void = () => {
})
fail(
`${issuesFound}${summary.data.vulnerabilities.high} high vulnerabilities and ` +
`${summary.data.vulnerabilities.critical} critical vulnerabilities found`
`${summary.data.vulnerabilities.critical} critical vulnerabilities found`
)
}
} else {
Expand Down Expand Up @@ -131,13 +132,12 @@ const checkDependencyChanges: () => void = () => {
// Check for any changes to the contributors section of package.json
schedule(async () => {
if (!shouldRun) {
return;
return
}
const pd = await danger.git.JSONDiffForFile('package.json')

if (pd.contributors) {
const message =
'Do not make changes to package.json around contributors.'
const message = 'Do not make changes to package.json around contributors.'
const idea =
'This project only uses .all-contributorsrc for tracking contributors.'
fail(`${message} - <i>${idea}</i>`)
Expand Down

0 comments on commit 2f2ed1e

Please sign in to comment.