Skip to content

Commit 2f88085

Browse files
authored
Github Action: Directly install from repo if export-subst is skipped (psf#4313)
1 parent 12ce3db commit 2f88085

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

CHANGES.md

+2
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@
4646

4747
<!-- For example, Docker, GitHub Actions, pre-commit, editors -->
4848

49+
- Github Action now works even when `git archive` is skipped (#4313)
50+
4951
### Documentation
5052

5153
<!-- Major changes to documentation and policies. Small docs changes

action/main.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
BLACK_VERSION_RE = re.compile(r"^black([^A-Z0-9._-]+.*)$", re.IGNORECASE)
2121
EXTRAS_RE = re.compile(r"\[.*\]")
22+
EXPORT_SUBST_FAIL_RE = re.compile(r"\$Format:.*\$")
2223

2324

2425
def determine_version_specifier() -> str:
@@ -135,7 +136,11 @@ def find_black_version_in_array(array: object) -> Union[str, None]:
135136
# expected format is one of:
136137
# - 23.1.0
137138
# - 23.1.0-51-g448bba7
138-
if describe_name.count("-") < 2:
139+
# - $Format:%(describe:tags=true,match=*[0-9]*)$ (if export-subst fails)
140+
if (
141+
describe_name.count("-") < 2
142+
and EXPORT_SUBST_FAIL_RE.match(describe_name) is None
143+
):
139144
# the action's commit matches a tag exactly, install exact version from PyPI
140145
req = f"black{extra_deps}=={describe_name}"
141146
else:

0 commit comments

Comments
 (0)