Github Action: Directly install from repo if export-subst is skipped (#4313)

This commit is contained in:
S.S 2024-04-24 12:01:53 +09:00 committed by GitHub
parent 12ce3db077
commit 2f88085da5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 1 deletions

View File

@ -46,6 +46,8 @@
<!-- For example, Docker, GitHub Actions, pre-commit, editors -->
- Github Action now works even when `git archive` is skipped (#4313)
### Documentation
<!-- Major changes to documentation and policies. Small docs changes

View File

@ -19,6 +19,7 @@
BLACK_VERSION_RE = re.compile(r"^black([^A-Z0-9._-]+.*)$", re.IGNORECASE)
EXTRAS_RE = re.compile(r"\[.*\]")
EXPORT_SUBST_FAIL_RE = re.compile(r"\$Format:.*\$")
def determine_version_specifier() -> str:
@ -135,7 +136,11 @@ def find_black_version_in_array(array: object) -> Union[str, None]:
# expected format is one of:
# - 23.1.0
# - 23.1.0-51-g448bba7
if describe_name.count("-") < 2:
# - $Format:%(describe:tags=true,match=*[0-9]*)$ (if export-subst fails)
if (
describe_name.count("-") < 2
and EXPORT_SUBST_FAIL_RE.match(describe_name) is None
):
# the action's commit matches a tag exactly, install exact version from PyPI
req = f"black{extra_deps}=={describe_name}"
else: