@@ -15,14 +15,14 @@ def update_changelog():
15
15
if previous == version :
16
16
print (f"No changes to version { version } " )
17
17
return
18
- print (f"Adding logs from { previous } ..{ version } " )
18
+ print (f"Adding logs from { previous } ..v { version } " )
19
19
20
20
raw_current_branch = subprocess .run ([
21
21
"git" ,
22
22
"branch" ,
23
23
"--show-current" ,
24
24
], capture_output = True )
25
- current_branch = raw_current_branch .stdout .decode ('utf-8' )
25
+ current_branch = raw_current_branch .stdout .decode ('utf-8' ). strip ()
26
26
27
27
raw_commits = subprocess .run ([
28
28
"git" ,
@@ -31,9 +31,12 @@ def update_changelog():
31
31
"--oneline" ,
32
32
], capture_output = True )
33
33
commits = [line [:7 ] for line in raw_commits .stdout .decode ('utf-8' ).split ('\n ' )]
34
+ print (commits )
34
35
35
36
prs = set ()
36
37
for commit in commits :
38
+ if not commit :
39
+ continue
37
40
commit_output = subprocess .run ([
38
41
'gh' ,
39
42
'pr' ,
@@ -42,8 +45,16 @@ def update_changelog():
42
45
'author,number,title,url' ,
43
46
'--search' ,
44
47
f'"{ commit } "' ,
48
+ '--state' ,
49
+ 'merged' ,
45
50
], capture_output = True )
46
- commit_details = json .loads (commit_output .stdout .decode ('utf-8' ))[0 ]
51
+
52
+ commit_details = commit_output .stdout .decode ('utf-8' )
53
+ if not commit_details or not json .loads (commit_details ):
54
+ continue
55
+ commit_details = json .loads (commit_details )[0 ]
56
+
57
+
47
58
if not commit_details ['number' ]:
48
59
continue
49
60
if commit_details ['number' ] in prs :
@@ -52,7 +63,7 @@ def update_changelog():
52
63
changelog .append (f"* { commit_details ['title' ]} by @{ commit_details ['author' ]['login' ]} in { commit_details ['url' ]} " )
53
64
54
65
changelog .append ('\n ' )
55
- changelog .append (f"**Full Changelog**: https://github.com/codecov/codecov-action/compare/{ previous } ..{ version } \n " )
66
+ changelog .append (f"**Full Changelog**: https://github.com/codecov/codecov-action/compare/{ previous } ..v { version } \n " )
56
67
57
68
with open ('CHANGELOG.md' , 'r' ) as f :
58
69
for line in f :
0 commit comments