Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@

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

- Enhance GitHub Action `psf/black` to support the `required-version` major-version-only
"stability" format when using pyproject.toml (#4770)

### Documentation

<!-- Major changes to documentation and policies. Small docs changes
Expand Down
6 changes: 5 additions & 1 deletion action/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,11 @@ def read_version_specifier_from_pyproject() -> str:

version = pyproject.get("tool", {}).get("black", {}).get("required-version")
if version is not None:
return f"=={version}"
# Match the two supported usages of `required-version`:
if "." in version:
return f"=={version}"
else:
return f"~={version}.0"

arrays = [
*pyproject.get("dependency-groups", {}).values(),
Expand Down
Loading