fix(github_repository_file): Commit detail changes should not do empty commits
When terraform changes any field related to how commits are done (email, commit message, etc), it pushes an unexpected empty commit to the repo.
This is specially relevant when importing an existing file into terraform, where the commit message you put in terraform will likely be different from the commit that pushed the file originally. In that sense, importing a file will always mean eventually doing empty commits for each file you imported.
The expected behaviour is just updating the state and avoid doing those empty commits. Otherwise, each empty commit can run any CI that might be configured, notifications, etc.
Resolves #689 Recreated from #2638
Before the change?
- When any of
commit_sha,commit_author,commit_emailorcommit_messagechanged, it did a empty commit
After the change?
- Now, it checks which fields have changes and only commits if there are changes in any other field
Pull request checklist
- [x] Tests for the changes have been added (for bug fixes / features)
- [x] Docs have been reviewed and added / updated if needed (for bug fixes / features)
Does this introduce a breaking change?
Please see our docs on breaking changes to help!
- [ ] Yes
- [x] No
@nickfloyd Hey, this PR was outdated due to being open for several months, so I just updated it with the latest main and resolved all conflicts.
Could you review it when you get a chance? Thanks