Skip to content

Commit

Permalink
Github Action: Directly install from repo if export-subst is skipped (
Browse files Browse the repository at this point in the history
  • Loading branch information
EarlMilktea committed Apr 24, 2024
1 parent 12ce3db commit 2f88085
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
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

0 comments on commit 2f88085

Please sign in to comment.