Various fixes for leaving a messy git state #280
Merged
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.
The CLI was never very hygienic with the git state it leaves after a local run. As we
refactored things such that the common use case is "local" on GitHub Actions, this
became a problem. It resulted in weird PRs being created by
create-pull-request
action.
These fixes should address what I've found so far.
Only commit paths we restyled
ed2f4dd
This avoids unintentionally including other files we may have created,
such as downloaded files or backup files produced by a restyler.
Run git-clean at the end, by default
f25f036
This ensures any files created by the restyling process are cleaned up,
which is important to prevent any create-pull-request action running
after us from including them in its own commit.
Behavior can be disabled by
NO_CLEAN
/--no-clean
.Prevent empty changesets when restylers offset each other
3ff33ab
Sometimes, two restylers can "fight". One changes code one way and then
another puts it exactly back. When this happens, each restyler will
generate their own commit, but the overall changeset will be empty.
If we don't explicitly check for this, using the create-pull-request
action will still produce a PR because there are commits, even if the
overall diff is empty. This empty PR might just be merged out of habit
or process, triggering the process to repeat again.
So we'll explicitly check:
{sha}^
)git reset --hard
back to itVersion bump
ba396c0