@@ -12,20 +12,31 @@ def process_commits():
12
12
13
13
processed = []
14
14
for line in commits :
15
+ # Skip [cron] commits
16
+ if '[cron]' in line :
17
+ continue
18
+
19
+ line = line .strip ()
15
20
# Extract the commit hash
16
- match = re .search (r'\(([a-f0-9]+)\)$' , line . strip () )
21
+ match = re .search (r'\(([a-f0-9]+)\)$' , line )
17
22
if match :
18
23
commit_hash = match .group (1 )
19
24
author = get_author_for_commit (commit_hash )
20
25
21
- # Check if line ends with issue number
22
- if re .search (r'\(#\d+\)$' , line .strip ()):
23
- # Remove the commit hash since we have an issue number
24
- new_line = line .strip ()[:- 9 ] + f" by { author } " + line .strip ()[- 9 :]
26
+ # Remove the commit hash from the end
27
+ line = line [:- len (commit_hash )- 3 ]
28
+
29
+ # Check if line contains issue/PR number
30
+ pr_match = re .search (r'\(#\d+\)$' , line )
31
+ if pr_match :
32
+ # Format with PR number
33
+ pr_num = pr_match .group ()
34
+ line = line [:- len (pr_num )] + f"by { author } { pr_num } "
25
35
else :
26
- # Keep the commit hash since there's no issue number
27
- new_line = line .strip ()[:- 8 ] + f" by { author } " + line .strip ()[- 8 :]
28
- processed .append (new_line )
36
+ # Format with commit hash
37
+ line = line .strip () + f"by { author } ({ commit_hash } )"
38
+
39
+ processed .append (line )
29
40
30
41
# Write processed commits
31
42
with open ('commits.txt' , 'w' ) as f :
0 commit comments