Skip to content

Commit

Permalink
Fix logic to check if changelog file was modified
Browse files Browse the repository at this point in the history
  • Loading branch information
pietrocaselani committed May 4, 2019
1 parent 0adbc23 commit 6b21aa7
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,13 @@ platform :ios do
end

private_lane :is_building_ci_commit do
tag = sh('git describe --tags --abbrev=0', log: false).chomp

has_message = sh('git log --oneline -1', log: false).include? 'Bump build'
changelog_changed = sh("git diff --name-only #{tag}..HEAD | grep changelog.md", log: false, error_callback: ->(_) {}).strip == 'changelog.md'

changelog_changed = sh(
"git tag --sort=version:refname | tail -n 2 | xargs -L1 bash -c 'git diff --name-only $0..$1' | xargs | grep 'changelog.md'",
log: false,
error_callback: ->(_) {}
).include? 'changelog.md'

has_message && changelog_changed
end
Expand Down

0 comments on commit 6b21aa7

Please sign in to comment.