ciena-blueplanet / pr-bumper

Bump the version of an npm package based on a GitHub Pull Request
MIT License
19 stars 17 forks source link

Commit bump is happening on #none# bump when no change to code coverage has occurred #146

Open juwara0 opened 6 years ago

juwara0 commented 6 years ago

Issue Description:

This issue was encountered with pr-bumper version 3.

A PR was created and merged with #none# as the semver. This repo also has code coverage validation enabled. (https://github.com/ciena-frost/ember-frost-core/pull/550)

https://github.com/ciena-frost/ember-frost-core/blob/b58b91d279a23b8c563d363c37c6a306f2cb84dc/.pr-bumper.json#L6-L8

https://github.com/ciena-frost/ember-frost-core/blob/b58b91d279a23b8c563d363c37c6a306f2cb84dc/package.json#L99-L101

screen shot 2018-03-19 at 1 52 45 pm

Error message while running merge build

https://travis-ci.org/ciena-frost/ember-frost-core/jobs/355431705

The command "$(npm root -g)/pr-bumper/.travis/maybe-test.sh" exited with 0.
0.49s$ .travis/maybe-check-coverage.sh
pr-bumper: Code Coverage: `94.22%` (no change)
The command ".travis/maybe-check-coverage.sh" exited with 0.
1.12s$ .travis/maybe-bump-version.sh
pr-bumper: ERROR: Command failed: git commit -m "[pr-bumper] Automated code coverage update" -m "From CI build 1380"
The command ".travis/maybe-bump-version.sh" exited with 1.
cache.2
store build cache
0.01s
15.73schanges detected, packing new archive
.
.
uploading archive
Done. Your build exited with 1.

It appears that what might be happening is that the code coverage information is being written back to the package.json file even when the coverage pct number did not change. This would cause the info.modifiedFiles.length not be equal to 0. (https://github.com/ciena-blueplanet/pr-bumper/blob/master/lib/bumper.js#L339)

A possible fix might be to check to see if the coverage pct changed, and if not, do not write out and update modifiedFiles: In this stanza here: https://github.com/ciena-blueplanet/pr-bumper/blob/master/lib/bumper.js#L532-L535 there should probably be a check to see if it changed, and, if not, don’t write it out and update modifiedFiles