@@ -232,11 +232,28 @@ def validate_repo_state(self, repo):
232
232
233
233
def validate_release_state (self , repo ):
234
234
"""Validate if a repo 1) has a release, and 2) if there have been commits
235
- since the last release.
235
+ since the last release. Only files that drive user-facing changes
236
+ will be considered when flagging a repo as needing a release.
236
237
237
238
If 2), categorize by length of time passed since oldest commit after the release,
238
239
and return the number of days that have passed since the oldest commit.
239
240
"""
241
+
242
+ def _filter_file_diffs (filenames ):
243
+ _ignored_files = {
244
+ "CODE_OF_CONDUCT.md" ,
245
+ "LICENSE" ,
246
+ "setup.py.disabled" ,
247
+ }
248
+ compare_files = [
249
+ name for name in filenames if not name .startswith ("." )
250
+ ]
251
+ non_ignored_files = list (
252
+ set (compare_files ).difference (_ignored_files )
253
+ )
254
+
255
+ return non_ignored_files
256
+
240
257
if not (repo ["owner" ]["login" ] == "adafruit" and
241
258
repo ["name" ].startswith ("Adafruit_CircuitPython" )):
242
259
return []
@@ -281,28 +298,37 @@ def validate_release_state(self, repo):
281
298
return [ERROR_OUTPUT_HANDLER ]
282
299
compare_tags_json = compare_tags .json ()
283
300
if "status" in compare_tags_json :
284
- if compare_tags .json ()["status" ] != "identical" :
285
- oldest_commit_date = datetime .datetime .today ()
286
- for commit in compare_tags_json ["commits" ]:
287
- commit_date = datetime .datetime .strptime (commit ["commit" ]["committer" ]["date" ], "%Y-%m-%dT%H:%M:%SZ" )
288
- if commit_date < oldest_commit_date :
289
- oldest_commit_date = commit_date
290
-
291
- date_diff = datetime .datetime .today () - oldest_commit_date
292
- #print("{0} Release State:\n Tag Name: {1}\tRelease Date: {2}\n Today: {3}\t Released {4} days ago.".format(repo["name"], tag_name, oldest_commit_date, datetime.datetime.today(), date_diff.days))
293
- #print("Compare {4} status: {0} \n Ahead: {1} \t Behind: {2} \t Commits: {3}".format(
294
- # compare_tags_json["status"], compare_tags_json["ahead_by"],
295
- # compare_tags_json["behind_by"], compare_tags_json["total_commits"], repo["full_name"]))
296
- if date_diff .days > datetime .date .today ().max .day :
297
- return [(ERROR_GITHUB_COMMITS_SINCE_LAST_RELEASE_GTM ,
298
- date_diff .days )]
299
- elif date_diff .days <= datetime .date .today ().max .day :
300
- if date_diff .days > 7 :
301
- return [(ERROR_GITHUB_COMMITS_SINCE_LAST_RELEASE_1M ,
302
- date_diff .days )]
303
- else :
304
- return [(ERROR_GITHUB_COMMITS_SINCE_LAST_RELEASE_1W ,
301
+ if compare_tags_json ["status" ] != "identical" :
302
+
303
+ comp_filenames = [
304
+ file ["filename" ] for file in compare_tags_json .get ("files" )
305
+ ]
306
+ filtered_files = _filter_file_diffs (comp_filenames )
307
+
308
+ if filtered_files :
309
+ oldest_commit_date = datetime .datetime .today ()
310
+ for commit in compare_tags_json ["commits" ]:
311
+ commit_date_val = commit ["commit" ]["committer" ]["date" ]
312
+ commit_date = datetime .datetime .strptime (commit_date_val ,
313
+ "%Y-%m-%dT%H:%M:%SZ" )
314
+ if commit_date < oldest_commit_date :
315
+ oldest_commit_date = commit_date
316
+
317
+ date_diff = datetime .datetime .today () - oldest_commit_date
318
+ #print("{0} Release State:\n Tag Name: {1}\tRelease Date: {2}\n Today: {3}\t Released {4} days ago.".format(repo["name"], tag_name, oldest_commit_date, datetime.datetime.today(), date_diff.days))
319
+ #print("Compare {4} status: {0} \n Ahead: {1} \t Behind: {2} \t Commits: {3}".format(
320
+ # compare_tags_json["status"], compare_tags_json["ahead_by"],
321
+ # compare_tags_json["behind_by"], compare_tags_json["total_commits"], repo["full_name"]))
322
+ if date_diff .days > datetime .date .today ().max .day :
323
+ return [(ERROR_GITHUB_COMMITS_SINCE_LAST_RELEASE_GTM ,
305
324
date_diff .days )]
325
+ elif date_diff .days <= datetime .date .today ().max .day :
326
+ if date_diff .days > 7 :
327
+ return [(ERROR_GITHUB_COMMITS_SINCE_LAST_RELEASE_1M ,
328
+ date_diff .days )]
329
+ else :
330
+ return [(ERROR_GITHUB_COMMITS_SINCE_LAST_RELEASE_1W ,
331
+ date_diff .days )]
306
332
elif "errors" in compare_tags_json :
307
333
# replace 'output_handler' with ERROR_OUTPUT_HANDLER
308
334
err_msg = [
0 commit comments