committed by
GitHub
24 changed files with 264 additions and 38 deletions
@ -24,6 +24,8 @@ jobs: |
|||||
env: |
env: |
||||
GITHUB_CONTEXT: ${{ toJson(github) }} |
GITHUB_CONTEXT: ${{ toJson(github) }} |
||||
run: echo "$GITHUB_CONTEXT" |
run: echo "$GITHUB_CONTEXT" |
||||
|
# pin to actions/checkout@v5 for compatibility with latest-changes |
||||
|
# Ref: https://github.com/actions/checkout/issues/2313 |
||||
- uses: actions/checkout@v5 |
- uses: actions/checkout@v5 |
||||
with: |
with: |
||||
# To allow latest-changes to commit to the main branch |
# To allow latest-changes to commit to the main branch |
||||
@ -34,7 +36,7 @@ jobs: |
|||||
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.debug_enabled == 'true' }} |
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.debug_enabled == 'true' }} |
||||
with: |
with: |
||||
limit-access-to-actor: true |
limit-access-to-actor: true |
||||
- uses: tiangolo/[email protected].0 |
- uses: tiangolo/[email protected].1 |
||||
with: |
with: |
||||
token: ${{ secrets.GITHUB_TOKEN }} |
token: ${{ secrets.GITHUB_TOKEN }} |
||||
latest_changes_file: docs/en/docs/release-notes.md |
latest_changes_file: docs/en/docs/release-notes.md |
||||
|
|||||
@ -0,0 +1,88 @@ |
|||||
|
name: pre-commit |
||||
|
|
||||
|
on: |
||||
|
pull_request: |
||||
|
types: |
||||
|
- opened |
||||
|
- synchronize |
||||
|
|
||||
|
env: |
||||
|
IS_FORK: ${{ github.event.pull_request.head.repo.full_name != github.repository }} |
||||
|
|
||||
|
jobs: |
||||
|
pre-commit: |
||||
|
runs-on: ubuntu-latest |
||||
|
steps: |
||||
|
- name: Dump GitHub context |
||||
|
env: |
||||
|
GITHUB_CONTEXT: ${{ toJson(github) }} |
||||
|
run: echo "$GITHUB_CONTEXT" |
||||
|
- uses: actions/checkout@v5 |
||||
|
name: Checkout PR for own repo |
||||
|
if: env.IS_FORK == 'false' |
||||
|
with: |
||||
|
# To be able to commit it needs more than the last commit |
||||
|
ref: ${{ github.head_ref }} |
||||
|
# A token other than the default GITHUB_TOKEN is needed to be able to trigger CI |
||||
|
token: ${{ secrets.PRE_COMMIT }} |
||||
|
# pre-commit lite ci needs the default checkout configs to work |
||||
|
- uses: actions/checkout@v5 |
||||
|
name: Checkout PR for fork |
||||
|
if: env.IS_FORK == 'true' |
||||
|
- name: Set up Python |
||||
|
uses: actions/setup-python@v6 |
||||
|
with: |
||||
|
python-version: "3.14" |
||||
|
- name: Setup uv |
||||
|
uses: astral-sh/setup-uv@v7 |
||||
|
with: |
||||
|
cache-dependency-glob: | |
||||
|
requirements**.txt |
||||
|
pyproject.toml |
||||
|
uv.lock |
||||
|
- name: Install Dependencies |
||||
|
run: | |
||||
|
uv venv |
||||
|
uv pip install -r requirements.txt |
||||
|
- name: Run pre-commit |
||||
|
id: precommit |
||||
|
run: | |
||||
|
# Fetch the base branch for comparison |
||||
|
git fetch origin ${{ github.base_ref }} |
||||
|
uvx pre-commit run --from-ref origin/${{ github.base_ref }} --to-ref HEAD --show-diff-on-failure |
||||
|
continue-on-error: true |
||||
|
- name: Commit and push changes |
||||
|
if: env.IS_FORK == 'false' |
||||
|
run: | |
||||
|
git config user.name "github-actions[bot]" |
||||
|
git config user.email "github-actions[bot]@users.noreply.github.com" |
||||
|
git add -A |
||||
|
if git diff --staged --quiet; then |
||||
|
echo "No changes to commit" |
||||
|
else |
||||
|
git commit -m "🎨 Auto format" |
||||
|
git push |
||||
|
fi |
||||
|
- uses: pre-commit-ci/[email protected] |
||||
|
if: env.IS_FORK == 'true' |
||||
|
with: |
||||
|
msg: 🎨 Auto format |
||||
|
- name: Error out on pre-commit errors |
||||
|
if: steps.precommit.outcome == 'failure' |
||||
|
run: exit 1 |
||||
|
|
||||
|
# https://github.com/marketplace/actions/alls-green#why |
||||
|
pre-commit-alls-green: # This job does nothing and is only used for the branch protection |
||||
|
if: always() |
||||
|
needs: |
||||
|
- pre-commit |
||||
|
runs-on: ubuntu-latest |
||||
|
steps: |
||||
|
- name: Dump GitHub context |
||||
|
env: |
||||
|
GITHUB_CONTEXT: ${{ toJson(github) }} |
||||
|
run: echo "$GITHUB_CONTEXT" |
||||
|
- name: Decide whether the needed jobs succeeded or failed |
||||
|
uses: re-actors/alls-green@release/v1 |
||||
|
with: |
||||
|
jobs: ${{ toJSON(needs) }} |
||||
@ -1,25 +1,29 @@ |
|||||
# See https://pre-commit.com for more information |
# See https://pre-commit.com for more information |
||||
# See https://pre-commit.com/hooks.html for more hooks |
# See https://pre-commit.com/hooks.html for more hooks |
||||
default_language_version: |
|
||||
python: python3.10 |
|
||||
repos: |
repos: |
||||
- repo: https://github.com/pre-commit/pre-commit-hooks |
- repo: https://github.com/pre-commit/pre-commit-hooks |
||||
rev: v6.0.0 |
rev: v6.0.0 |
||||
hooks: |
hooks: |
||||
- id: check-added-large-files |
- id: check-added-large-files |
||||
- id: check-toml |
- id: check-toml |
||||
- id: check-yaml |
- id: check-yaml |
||||
args: |
args: |
||||
- --unsafe |
- --unsafe |
||||
- id: end-of-file-fixer |
- id: end-of-file-fixer |
||||
- id: trailing-whitespace |
- id: trailing-whitespace |
||||
- repo: https://github.com/astral-sh/ruff-pre-commit |
- repo: https://github.com/astral-sh/ruff-pre-commit |
||||
rev: v0.14.3 |
rev: v0.14.3 |
||||
hooks: |
hooks: |
||||
- id: ruff |
- id: ruff |
||||
args: |
args: |
||||
- --fix |
- --fix |
||||
- id: ruff-format |
- id: ruff-format |
||||
ci: |
- repo: local |
||||
autofix_commit_msg: 🎨 [pre-commit.ci] Auto format from pre-commit.com hooks |
hooks: |
||||
autoupdate_commit_msg: ⬆ [pre-commit.ci] pre-commit autoupdate |
- 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 |
||||
|
|||||
Loading…
Reference in new issue