Browse Source
👷 Add pre-commit config with local script for permalinks (#14398)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
pull/14402/head
Sebastián Ramírez
8 months ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with
37 additions and
13 deletions
-
.github/workflows/pre-commit.yml
-
.gitignore
-
.pre-commit-config.yaml
-
requirements.txt
-
scripts/docs.py
|
|
@ -7,7 +7,6 @@ on: |
|
|
- synchronize |
|
|
- synchronize |
|
|
|
|
|
|
|
|
env: |
|
|
env: |
|
|
UV_SYSTEM_PYTHON: 1 |
|
|
|
|
|
IS_FORK: ${{ github.event.pull_request.head.repo.full_name != github.repository }} |
|
|
IS_FORK: ${{ github.event.pull_request.head.repo.full_name != github.repository }} |
|
|
|
|
|
|
|
|
jobs: |
|
|
jobs: |
|
|
@ -41,6 +40,10 @@ jobs: |
|
|
requirements**.txt |
|
|
requirements**.txt |
|
|
pyproject.toml |
|
|
pyproject.toml |
|
|
uv.lock |
|
|
uv.lock |
|
|
|
|
|
- name: Install Dependencies |
|
|
|
|
|
run: | |
|
|
|
|
|
uv venv |
|
|
|
|
|
uv pip install -r requirements.txt |
|
|
- name: Run pre-commit |
|
|
- name: Run pre-commit |
|
|
id: precommit |
|
|
id: precommit |
|
|
run: | |
|
|
run: | |
|
|
@ -69,7 +72,7 @@ jobs: |
|
|
run: exit 1 |
|
|
run: exit 1 |
|
|
|
|
|
|
|
|
# https://github.com/marketplace/actions/alls-green#why |
|
|
# https://github.com/marketplace/actions/alls-green#why |
|
|
alls-green: # This job does nothing and is only used for the branch protection |
|
|
pre-commit-alls-green: # This job does nothing and is only used for the branch protection |
|
|
if: always() |
|
|
if: always() |
|
|
needs: |
|
|
needs: |
|
|
- pre-commit |
|
|
- pre-commit |
|
|
|
|
|
@ -28,3 +28,6 @@ archive.zip |
|
|
|
|
|
|
|
|
# macOS |
|
|
# macOS |
|
|
.DS_Store |
|
|
.DS_Store |
|
|
|
|
|
|
|
|
|
|
|
# Ignore while the setup still depends on requirements.txt files |
|
|
|
|
|
uv.lock |
|
|
|
|
|
@ -18,3 +18,12 @@ repos: |
|
|
args: |
|
|
args: |
|
|
- --fix |
|
|
- --fix |
|
|
- id: ruff-format |
|
|
- id: ruff-format |
|
|
|
|
|
- repo: local |
|
|
|
|
|
hooks: |
|
|
|
|
|
- id: local-script |
|
|
|
|
|
language: unsupported |
|
|
|
|
|
name: local script |
|
|
|
|
|
entry: uv run ./scripts/docs.py add-permalinks-pages |
|
|
|
|
|
args: |
|
|
|
|
|
- --update-existing |
|
|
|
|
|
files: ^docs/en/docs/.*\.md$ |
|
|
|
|
|
@ -1,6 +1,6 @@ |
|
|
-e .[all] |
|
|
-e .[all] |
|
|
-r requirements-tests.txt |
|
|
-r requirements-tests.txt |
|
|
-r requirements-docs.txt |
|
|
-r requirements-docs.txt |
|
|
pre-commit >=2.17.0,<5.0.0 |
|
|
pre-commit >=4.5.0,<5.0.0 |
|
|
# For generating screenshots |
|
|
# For generating screenshots |
|
|
playwright |
|
|
playwright |
|
|
|
|
|
@ -520,6 +520,15 @@ def add_permalinks_page(path: Path, update_existing: bool = False): |
|
|
f.writelines(updated_lines) |
|
|
f.writelines(updated_lines) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@app.command() |
|
|
|
|
|
def add_permalinks_pages(pages: List[Path], update_existing: bool = False) -> None: |
|
|
|
|
|
""" |
|
|
|
|
|
Add or update header permalinks in specific pages of En docs. |
|
|
|
|
|
""" |
|
|
|
|
|
for md_file in pages: |
|
|
|
|
|
add_permalinks_page(md_file, update_existing=update_existing) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@app.command() |
|
|
@app.command() |
|
|
def add_permalinks(update_existing: bool = False) -> None: |
|
|
def add_permalinks(update_existing: bool = False) -> None: |
|
|
""" |
|
|
""" |
|
|
|