Skip to content

Commit 8673d05

Browse files
committed
Fix github actions tag parsing
1 parent 326f491 commit 8673d05

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

build.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -198,14 +198,16 @@ def seven_zip_compress(input_path, output_path):
198198
def get_chapter_name_and_translation_from_git_tag():
199199
returned_chapter_name = None
200200
translation = False
201+
tag_fragments_debug = 'tag fragments not extracted - maybe missing GITHUB_REF?' #type: str
201202

202203
if GIT_TAG is None:
203204
raise Exception(
204205
"'github_actions' was selected, but environment variable GITHUB_REF was not set - are you sure you're running this script from Github Actions?"
205206
)
206207
else:
207208
# Look for the chapter name to build in the git tag
208-
tag_fragments = [x.lower() for x in re.split(r"[\W_]", GIT_REF)]
209+
tag_fragments = [x.lower() for x in re.split(r"_", GIT_REF)]
210+
tag_fragments_debug = str(tag_fragments)
209211

210212
if "all" in tag_fragments:
211213
returned_chapter_name = "all"
@@ -218,7 +220,7 @@ def get_chapter_name_and_translation_from_git_tag():
218220
if "translation" in tag_fragments:
219221
translation = True
220222

221-
return returned_chapter_name, translation
223+
return returned_chapter_name, translation, tag_fragments_debug
222224

223225

224226
def get_build_variants(selected_chapter: str) -> List[BuildVariant]:
@@ -323,11 +325,12 @@ def save(self):
323325
# Get chapter name from git tag if "github_actions" specified as the chapter
324326
chapter_name = args.chapter
325327
if chapter_name == "github_actions":
326-
chapter_name, translation = get_chapter_name_and_translation_from_git_tag()
328+
chapter_name, translation, tag_fragments_debug = get_chapter_name_and_translation_from_git_tag()
327329
if chapter_name is None:
328330
print(
329-
f">>>> WARNING: No chapter name (or 'all') was found in git tag {GIT_TAG} - skipping building .assets"
331+
f">>>> WARNING: No chapter name was found in git tag {GIT_TAG} parsed as {tag_fragments_debug} - skipping building .assets"
330332
)
333+
print(f">>>> Should contain one of {chapter_to_build_variants.keys()} or 'all'")
331334
exit(0)
332335

333336
# NOTE: For now, translation archive output is enabled by default, as most of the time this script will be used for translators

0 commit comments

Comments
 (0)