All patches and comments are welcome. Please squash your changes to logical
commits before using git-format-patch and git-send-email to
patches@git.madduck.net.
If you'd read over the Git project's submission guidelines and adhered to them,
I'd be especially grateful.
summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
4c99900)
Co-authored-by: Richard Si <63936253+ichard26@users.noreply.github.com>
<!-- For example, Docker, GitHub Actions, pre-commit, editors -->
<!-- For example, Docker, GitHub Actions, pre-commit, editors -->
+- Update GitHub Action to support use of version specifiers (e.g. `<23`) for Black
+ version (#3265)
+
### Documentation
<!-- Major changes to documentation and policies. Small docs changes
### Documentation
<!-- Major changes to documentation and policies. Small docs changes
run([sys.executable, "-m", "venv", str(ENV_PATH)], check=True)
run([sys.executable, "-m", "venv", str(ENV_PATH)], check=True)
-req = "black[colorama]"
-if VERSION:
- req += f"=={VERSION}"
+version_specifier = VERSION
+if VERSION and VERSION[0] in "0123456789":
+ version_specifier = f"=={VERSION}"
+req = f"black[colorama]{version_specifier}"
pip_proc = run(
[str(ENV_BIN / "python"), "-m", "pip", "install", req],
stdout=PIPE,
pip_proc = run(
[str(ENV_BIN / "python"), "-m", "pip", "install", req],
stdout=PIPE,
that. Note that the action's version you select is independent of the version of _Black_
the action will use.
that. Note that the action's version you select is independent of the version of _Black_
the action will use.
-The version of _Black_ the action will use can be configured via `version`. The action
-defaults to the latest release available on PyPI. Only versions available from PyPI are
-supported, so no commit SHAs or branch names.
+The version of _Black_ the action will use can be configured via `version`. This can be
+any
+[valid version specifier](https://packaging.python.org/en/latest/glossary/#term-Version-Specifier)
+or just the version number if you want an exact version. The action defaults to the
+latest release available on PyPI. Only versions available from PyPI are supported, so no
+commit SHAs or branch names.
You can also configure the arguments passed to _Black_ via `options` (defaults to
`'--check --diff'`) and `src` (default is `'.'`)
You can also configure the arguments passed to _Black_ via `options` (defaults to
`'--check --diff'`) and `src` (default is `'.'`)
src: "./src"
version: "21.5b1"
```
src: "./src"
version: "21.5b1"
```
+
+If you want to match versions covered by Black's
+[stability policy](labels/stability-policy), you can use the compatible release operator
+(`~=`):
+
+```yaml
+- uses: psf/black@stable
+ with:
+ options: "--check --verbose"
+ src: "./src"
+ version: "~= 22.0"
+```