Skip to content

Commit

Permalink
Updating Dangerfile so it fails when there are no changes to the chan…
Browse files Browse the repository at this point in the history
…gelog on a release
  • Loading branch information
NachoEmbrace committed Oct 16, 2024
1 parent 3e09c38 commit 2d16257
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions Dangerfile.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,20 @@ func main() {
let sourceChanges = editedFiles.first(where: { $0.hasPrefix("Sources") })
let testChanges = editedFiles.first(where: { $0.hasPrefix("Tests") })

// check changelog entry only if there were changes in the code
if !changelogChanged && sourceChanges != nil {
// for release candidates, there must be a changelog update
if danger.github.pullRequest.head.label.contains("release/") && !changelogChanged {
fail("Releases must have CHANGELOG updates.")

// otherwise only throw a warning if there was code changes without a changelog update
} else if !changelogChanged && sourceChanges != nil {
warn("No CHANGELOG entry added.")
}

// check tests only if there were changes in the code
if sourceChanges != nil && testChanges == nil {
warn("No tests added / modified.")
}

// lint modified files
SwiftLint.lint(.files(editedFiles), inline: true, quiet: false)
}
Expand Down

0 comments on commit 2d16257

Please sign in to comment.