fix(target) do not open a PR when a target does not change a file #377
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix #375
The problem was caused because the "if block" responsible to open the pull request was not position in the correct location.
To fix this issue, we are returning early when a target does not change anything: it removes 1 layer of "if/else" and it ensures that the "if" block responsible for PR creation is NEVER called when there isn"t any change.
Also, the "if block" had been put in the most specific if branch to avoid repeated conditions (!dry run and o.push).
=> IF it causes logic trouble in the cinematic for opening PR, then it means that addition refactoring will be required to ensure that the concept of "happy path" + "early return" are met. Unit tests would greatly help in this case.
Verified against https://github.com/dduportal/charts: