Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Github Action] Directly install from repo. if export-subst is skipped #4313

Merged
merged 3 commits into from
Apr 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,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
Expand Down
7 changes: 6 additions & 1 deletion action/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down