From 6cc137441a2853dd7c53d5a1273af7367ef15f00 Mon Sep 17 00:00:00 2001 From: Gio Lodi Date: Wed, 4 Dec 2024 08:55:44 +1100 Subject: [PATCH 1/3] Remove period from "Update draft release notes..." commit message The first line of a commit message should not have a period (`.`) I am not aware of any official Git documentation for the statement above. However, it has been a convention in all the projects and companies I worked on. The style is also present in the example commit message from the official Git book. See https://git-scm.com/docs/MyFirstContribution#:~:text=You%20will%20be%20presented%20with%20your,A%20U%20Thor%20%3Cauthor%40example.com%3E The style is also used in other sources, such as: - https://commit.style/ - https://www.gitkraken.com/learn/git/best-practices/git-commit-message#using-imperative-verb-form - https://thoughtbot.com/blog/5-useful-tips-for-a-better-commit-message One could argue that the 50 to 72 character length and the period omission were characters economy constraints from back in the day of small screens and text-only interfaces. While that is true, I find the are many benefits in forcing oneself to be concise in the commit title/summary. As for short line length, it works well for people like me, who use big font sizes because their eyes strain otherwise. But aside from all the justifications above, having commit message titles without a period is the existing convention in this repo, which make this change a no brainer. --- .../actions/common/extract_release_notes_for_version_action.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/extract_release_notes_for_version_action.rb b/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/extract_release_notes_for_version_action.rb index 0d1966bd0..c0dc76b0a 100644 --- a/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/extract_release_notes_for_version_action.rb +++ b/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/extract_release_notes_for_version_action.rb @@ -41,7 +41,7 @@ def self.extract_notes(release_notes_file_path, version) def self.check_and_commit_extracted_notes_file(file_path, version) Action.sh("git add #{file_path}") - Action.sh("git diff-index --quiet HEAD || git commit -m \"Update draft release notes for #{version}.\"") + Action.sh("git diff-index --quiet HEAD || git commit -m \"Update draft release notes for #{version}\"") end def self.description From 80a7a8f0ab003a6f2e0262c083e49e9b169c7c27 Mon Sep 17 00:00:00 2001 From: Gio Lodi Date: Wed, 4 Dec 2024 09:28:20 +1100 Subject: [PATCH 2/3] Add changelog entry for '.' removal from commit title --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bce107126..a756a4b80 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,7 +14,7 @@ _None_ ### Bug Fixes -_None_ +- Remove period from "Update draft release notes..." commit message [#622] ### Internal Changes From 72b0592d301ef3409981ff632e4dfcc550a2962e Mon Sep 17 00:00:00 2001 From: Olivier Halligon Date: Wed, 4 Dec 2024 11:32:26 +0100 Subject: [PATCH 3/3] Update git-commit implementation to use fastlane actions As suggested in https://github.com/wordpress-mobile/release-toolkit/pull/622#discussion_r1868447996 --- .../extract_release_notes_for_version_action.rb | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/extract_release_notes_for_version_action.rb b/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/extract_release_notes_for_version_action.rb index c0dc76b0a..5d7219707 100644 --- a/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/extract_release_notes_for_version_action.rb +++ b/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/extract_release_notes_for_version_action.rb @@ -17,7 +17,7 @@ def self.run(params) return if extracted_notes_file.nil? extracted_notes_file.close - check_and_commit_extracted_notes_file(extracted_notes_file_path, version) + commit_extracted_notes_file(extracted_notes_file_path, version) end def self.extract_notes(release_notes_file_path, version) @@ -39,9 +39,13 @@ def self.extract_notes(release_notes_file_path, version) end end - def self.check_and_commit_extracted_notes_file(file_path, version) - Action.sh("git add #{file_path}") - Action.sh("git diff-index --quiet HEAD || git commit -m \"Update draft release notes for #{version}\"") + def self.commit_extracted_notes_file(file_path, version) + other_action.git_add(path: file_path) + other_action.git_commit( + path: file_path, + message: "Update draft release notes for #{version}", + allow_nothing_to_commit: true + ) end def self.description