File tree Expand file tree Collapse file tree 4 files changed +20
-27
lines changed Expand file tree Collapse file tree 4 files changed +20
-27
lines changed Original file line number Diff line number Diff line change 14
14
if not os .environ .get ("RH_SINCE" ):
15
15
curr_dir = os .getcwd ()
16
16
os .chdir (CHECKOUT_NAME )
17
- since = get_latest_tag (os .environ ["RH_BRANCH" ]) or ""
17
+ since_last_stable = os .environ .get ("RH_SINCE_LAST_STABLE" )
18
+ since = get_latest_tag (os .environ ["RH_BRANCH" ], since_last_stable )
18
19
if since :
19
20
log (f"Capturing { since } in RH_SINCE variable" )
20
21
os .environ ["RH_SINCE" ] = since
Original file line number Diff line number Diff line change 38
38
if not os .environ .get ("RH_SINCE" ):
39
39
curr_dir = os .getcwd ()
40
40
os .chdir (CHECKOUT_NAME )
41
- since = get_latest_tag (os .environ ["RH_BRANCH" ]) or ""
41
+ since_last_stable = os .environ .get ("RH_SINCE_LAST_STABLE" )
42
+ since = get_latest_tag (os .environ ["RH_BRANCH" ], since_last_stable )
42
43
if since :
43
44
log (f"Capturing { since } in RH_SINCE variable" )
44
45
os .environ ["RH_SINCE" ] = since
Original file line number Diff line number Diff line change @@ -80,7 +80,7 @@ def get_version_entry(
80
80
str
81
81
A formatted changelog entry with markers
82
82
"""
83
- since = since or _get_since (ref or branch , since_last_stable )
83
+ since = since or util . get_latest_tag (ref or branch , since_last_stable )
84
84
85
85
util .log (f"Getting changes to { repo } since { since } on branch { branch } ..." )
86
86
@@ -290,23 +290,3 @@ def extract_current(changelog_path):
290
290
if start != - 1 and end != - 1 :
291
291
body = changelog [start + len (START_MARKER ) : end ]
292
292
return body
293
-
294
-
295
- def _get_since (source , since_last_stable = False ):
296
- """Get the appropriate since reference or None"""
297
- tags = util .run (
298
- f"git --no-pager tag --sort=-creatordate --merged { source } " , quiet = True
299
- )
300
- if not tags :
301
- return
302
-
303
- tags = tags .splitlines ()
304
-
305
- if since_last_stable :
306
- stable_tag = re .compile (r"\d\.\d\.\d$" )
307
- tags = [t for t in tags if re .search (stable_tag , t )]
308
- if not tags :
309
- return
310
- return tags [0 ]
311
-
312
- return tags [0 ]
Original file line number Diff line number Diff line change @@ -254,11 +254,22 @@ def actions_output(name, value):
254
254
print (f"::set-output name={ name } ::{ value } " )
255
255
256
256
257
- def get_latest_tag (branch ):
257
+ def get_latest_tag (source , since_last_stable = False ):
258
258
"""Get the default 'since' value for a branch"""
259
- tags = run (f"git --no-pager tag --sort=-creatordate --merged { branch } " , quiet = True )
260
- if tags :
261
- return tags .splitlines ()[0 ]
259
+ tags = run (f"git --no-pager tag --sort=-creatordate --merged { source } " , quiet = True )
260
+ if not tags :
261
+ return ""
262
+
263
+ tags = tags .splitlines ()
264
+
265
+ if since_last_stable :
266
+ stable_tag = re .compile (r"\d\.\d\.\d$" )
267
+ tags = [t for t in tags if re .search (stable_tag , t )]
268
+ if not tags :
269
+ return ""
270
+ return tags [0 ]
271
+
272
+ return tags [0 ]
262
273
263
274
264
275
def retry (cmd , ** kwargs ):
You can’t perform that action at this time.
0 commit comments