Skip to content

Commit d404219

Browse files
committed
Use the "other" type for newline-only diffs
In order to make the system as lenient as possible in regards to submission format, newline changes to the list are ignored (with the exception of final newline removal). For this reason, a PR consisting solely of changes to the newlines in the list results in a null list of URLs, as would be expected. The problem was that these PRs were assigned a "modification" type. A workflow job matrix is used to check the list of URLs generated from a "modification" request "update" mode to see whether they are still compliant with the requirements in order to triage modification requests before the registry maintainer does the final manual review of the PR. GitHub Actions does not allow zero length job matrices, and anyway this sort of PR does not match with the meaning we have assigned the "modification" type. The "other" type is most appropriate for this type of PR. "other" type requests are also manually reviewed, but without the automated triage.
1 parent 663efed commit d404219

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

main.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,9 @@ func parseDiff(rawDiff []byte, listName string) (string, string, string, []strin
223223

224224
var requestType string
225225
var arduinoLintLibraryManagerSetting string
226-
if addedCount > 0 && deletedCount == 0 {
226+
if addedCount == 0 && deletedCount == 0 {
227+
requestType = "other"
228+
} else if addedCount > 0 && deletedCount == 0 {
227229
requestType = "submission"
228230
arduinoLintLibraryManagerSetting = "submit"
229231
} else if addedCount == 0 && deletedCount > 0 {

main_test.go

+20
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,26 @@ index cff484d..8b401a1 100644
171171
assert.Equal(t, "", requestError, testName)
172172
assert.Equal(t, "update", arduinoLintLibraryManagerSetting, testName)
173173
assert.Equal(t, []string{"https://github.com/foo/bar"}, submissionURLs, testName)
174+
175+
testName = "Newline-only"
176+
diff = []byte(`
177+
diff --git a/repositories.txt b/repositories.txt
178+
index d9a6136..ca902d9 100644
179+
--- a/repositories.txt
180+
+++ b/repositories.txt
181+
@@ -1,4 +1,4 @@
182+
https://github.com/firmata/arduino
183+
-
184+
https://github.com/arduino-libraries/Ethernet
185+
https://github.com/lbernstone/plotutils
186+
+
187+
`)
188+
189+
requestType, requestError, arduinoLintLibraryManagerSetting, submissionURLs = parseDiff(diff, "repositories.txt")
190+
assert.Equal(t, "other", requestType, testName)
191+
assert.Equal(t, "", requestError, testName)
192+
assert.Equal(t, "", arduinoLintLibraryManagerSetting, testName)
193+
assert.Nil(t, submissionURLs, testName)
174194
}
175195

176196
func Test_normalizeURL(t *testing.T) {

0 commit comments

Comments
 (0)