Add badges to README (#40)

This commit is contained in:
Charlie Marsh 2023-06-16 15:01:33 -04:00 committed by GitHub
parent ec8193bd58
commit 8698dbc7cd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 2 deletions

View File

@ -1,5 +1,11 @@
# ruff-pre-commit
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/charliermarsh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
[![image](https://img.shields.io/pypi/v/0.0.272/ruff.svg)](https://pypi.python.org/pypi/ruff)
[![image](https://img.shields.io/pypi/l/0.0.272/ruff.svg)](https://pypi.python.org/pypi/ruff)
[![image](https://img.shields.io/pypi/pyversions/0.0.272/ruff.svg)](https://pypi.python.org/pypi/ruff)
[![Actions status](https://github.com/astral-sh/ruff-pre-commit/workflows/CI/badge.svg)](https://github.com/astral-sh/ruff-pre-commit/actions)
A [pre-commit](https://pre-commit.com/) hook for [Ruff](https://github.com/charliermarsh/ruff).
Distributed as a standalone repository to enable installing Ruff via prebuilt wheels from
@ -36,3 +42,9 @@ reformatting.
## License
MIT
<div align="center">
<a target="_blank" href="https://astral.sh" style="background:none">
<img src="https://raw.githubusercontent.com/charliermarsh/ruff/main/assets/svg/Astral.svg">
</a>
</div>

View File

@ -9,9 +9,11 @@ def main():
readme_md = Path("README.md")
readme = readme_md.read_text()
rev = Path(".version").read_text().strip()
readme = re.sub("rev: .*", f"rev: v{rev}", readme)
readme = re.sub(r"rev: v\d+\.\d+\.\d+", f"rev: v{rev}", readme)
readme = re.sub(r"/\d+\.\d+\.\d+/ruff\.svg", f"/{rev}/ruff.svg", readme)
readme_md.write_text(readme)
# Only commit on change
# Only commit on change.
# https://stackoverflow.com/a/9393642/3549270
if check_output(["git", "status", "-s"]).strip():
check_call(["git", "add", readme_md])