Skip to content

Commit 5df199f

Browse files
committed
Use pre-commit-mirror-maker instead rolling our own
Signed-off-by: Bernát Gábor <[email protected]>
1 parent cae69c4 commit 5df199f

File tree

7 files changed

+53
-110
lines changed

7 files changed

+53
-110
lines changed

Diff for: .github/workflows/check.yaml

-29
This file was deleted.

Diff for: .github/workflows/main.yml

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Mirror
2+
on:
3+
push:
4+
branches: [main]
5+
pull_request:
6+
schedule:
7+
- cron: "30 8 * * *"
8+
9+
jobs:
10+
build:
11+
name: Mirror
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v4
15+
- run: git config --global user.name 'Github Actions'
16+
- run: git config --global user.email '41898282+github-actions[bot]@users.noreply.github.com'
17+
- name: Install the latest version of uv
18+
uses: astral-sh/setup-uv@v3
19+
with:
20+
version: "latest"
21+
- run: >-
22+
uvx --from pre-commit-mirror-maker pre-commit-mirror -p 3.13 . \
23+
--language=python --package-name=pyproject-fmt --files-regex '(^|/)pyproject\.toml$'
24+
- run: |
25+
git remote set-url origin https://x-access-token:[email protected]/$GITHUB_REPOSITORY
26+
git push origin HEAD:refs/heads/main --tags
27+
if: ${{ github.ref == 'refs/heads/main' }}
28+
env:
29+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Diff for: .github/workflows/mirror.yaml

-25
This file was deleted.

Diff for: .pre-commit-config.yaml

-11
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,6 @@ repos:
1414
hooks:
1515
- id: codespell
1616
additional_dependencies: ["tomli>=2.0.1"]
17-
- repo: https://github.com/tox-dev/pyproject-fmt
18-
rev: "2.4.3"
19-
hooks:
20-
- id: pyproject-fmt
21-
- repo: https://github.com/astral-sh/ruff-pre-commit
22-
rev: "v0.7.0"
23-
hooks:
24-
- id: ruff-format
25-
args: ["--config", "pyproject.toml"]
26-
- id: ruff
27-
args: ["--fix", "--unsafe-fixes", "--exit-non-zero-on-fix", "--config", "pyproject.toml"]
2817
- repo: https://github.com/rbubley/mirrors-prettier
2918
rev: "v3.3.3"
3019
hooks:

Diff for: README.md

+14-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,17 @@
11
# pyproject-fmt mirror
22

3-
[![Mirror](https://github.com/tox-dev/pyproject-fmt/actions/workflows/mirror.yaml/badge.svg)](https://github.com/tox-dev/pyproject-fmt/actions/workflows/mirror.yaml)
4-
[![Test](https://github.com/tox-dev/pyproject-fmt/actions/workflows/check.yaml/badge.svg)](https://github.com/tox-dev/pyproject-fmt/actions/workflows/check.yaml)
3+
[![Main](https://github.com/tox-dev/pyproject-fmt/actions/workflows/main.yaml/badge.svg)](https://github.com/tox-dev/pyproject-fmt/actions/workflows/main.yaml)
54

6-
The source code for this project now lives inside
7-
[toml-fmt](https://github.com/tox-dev/toml-fmt/tree/main/pyproject-fmt), this repository serves only as a mirror for
8-
pre-commit.
5+
Mirror of [`pyproject-fmt`](https://github.com/tox-dev/toml-fmt/tree/main/pyproject-fmt) for
6+
[pre-commit](https://github.com/pre-commit/pre-commit).
7+
8+
### Using `pyproject-fmt` with pre-commit
9+
10+
Add it to your `.pre-commit-config.yaml`:
11+
12+
```yaml
13+
- repo: https://github.com/pre-commit/pyproject-fmt
14+
rev: "" # Use the sha / tag you want to point at
15+
hooks:
16+
- id: pyproject-fmt
17+
```

Diff for: pyproject.toml

-40
This file was deleted.

Diff for: setup.py

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
from __future__ import annotations
2+
3+
from setuptools import setup
4+
5+
6+
setup(
7+
name="pre_commit_placeholder_package",
8+
version="0.0.0",
9+
install_requires=["pyproject-fmt==2.4.3"],
10+
)

0 commit comments

Comments
 (0)