This is an automated email from the ASF dual-hosted git repository.

potiuk pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow-site-archive.git

commit c54d622c85823c598e0d5d75363c198d39ca54dd
Author: Jarek Potiuk <ja...@potiuk.com>
AuthorDate: Sun May 11 13:37:12 2025 +0200

    Add pre-commit with GitHub Action to run it
---
 .github/workflows/build.yml        | 26 +++++++++++++++++++
 .github/workflows/github-to-s3.yml |  1 -
 .gitignore                         |  2 +-
 .pre-commit-config.yaml            | 51 ++++++++++++++++++++++++++++++++++++++
 README.md                          |  6 ++---
 5 files changed, 81 insertions(+), 5 deletions(-)

diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
new file mode 100644
index 0000000000..2a995d242f
--- /dev/null
+++ b/.github/workflows/build.yml
@@ -0,0 +1,26 @@
+name: Basic checks
+on:
+  push:
+    branches: ['main']
+  pull_request:
+  workflow_dispatch:
+
+jobs:
+  build:
+    runs-on: ["ubuntu-22.04"]
+    steps:
+      - name: 🪓 Remove some stuff we don't need
+        run: |
+          sudo rm -rf /usr/share/dotnet
+          sudo rm -rf /opt/ghc
+          sudo rm -rf "/usr/local/share/boost"
+          sudo rm -rf "$AGENT_TOOLSDIRECTORY"
+      - name: 🐍 Setup Python
+        uses: actions/setup-python@bd6b4b6205c4dbad673328db7b31b7fab9e241c0  # 
v4.6.1
+        with:
+          python-version: '3.9'
+      - name: 🔎 Lint
+        run: |
+          pip install pre-commit
+          pip install pre-commit-uv
+          pre-commit run --all-files
diff --git a/.github/workflows/github-to-s3.yml 
b/.github/workflows/github-to-s3.yml
index 5c5fe31daf..298c419cdb 100644
--- a/.github/workflows/github-to-s3.yml
+++ b/.github/workflows/github-to-s3.yml
@@ -190,4 +190,3 @@ jobs:
             --document-folders "${DOCUMENTS_FOLDERS}" \
             --commit-sha ${COMMIT_SHA} --sync-type ${SYNC_TYPE} \
             --processes ${PROCESSES}
-          
diff --git a/.gitignore b/.gitignore
index e42e468883..c8f3d2a350 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,4 @@
 __pycache__/
 .idea/*
 *.iml
-.venv/*
\ No newline at end of file
+.venv/*
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
new file mode 100644
index 0000000000..e2c9c4da9c
--- /dev/null
+++ b/.pre-commit-config.yaml
@@ -0,0 +1,51 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+---
+default_stages: [pre-commit, pre-push]
+default_language_version:
+  # force all unspecified python hooks to run python3
+  python: python3
+exclude: ^docs-archive
+repos:
+  - repo: meta
+    hooks:
+      - id: check-hooks-apply
+      - id: check-useless-excludes
+  - repo: https://github.com/Lucas-C/pre-commit-hooks
+    rev: v1.3.1
+    hooks:
+      - id: forbid-tabs
+  - repo: local
+    hooks:
+      - id: ruff
+        name: Run 'ruff' for extremely fast Python linting
+        description: "Run 'ruff' for extremely fast Python linting"
+        entry: ruff check --force-exclude
+        language: python
+        types_or: [python, pyi]
+        args: [--fix]
+        require_serial: true
+        additional_dependencies: ['ruff']
+  - repo: https://github.com/pre-commit/pre-commit-hooks
+    rev: v4.4.0
+    hooks:
+      - id: check-merge-conflict
+      - id: detect-private-key
+      - id: end-of-file-fixer
+      - id: mixed-line-ending
+      - id: trailing-whitespace
+        args: [--markdown-linebreak-ext=md]
diff --git a/README.md b/README.md
index c91b05afdc..25526b0a26 100644
--- a/README.md
+++ b/README.md
@@ -6,7 +6,7 @@
 It has the following command line arguments:
 - `--bucket-path`: The S3 bucket path where the documentation is stored.
 - `--local-path`: The local path where the documentation will be downloaded.
-- `--document-folder`: The folder in the S3 bucket where the documentation is 
stored (This is optional if any particular 
+- `--document-folder`: The folder in the S3 bucket where the documentation is 
stored (This is optional if any particular
                       folder need to be synced, provide the folder name ex: 
`apache-airflow-providers-amazon`).
 ```bash
 uv run ./scripts/s3_to_github.py --bucket-path 
s3://staging-docs-airflow-apache-org/docs/ --local-path ./docs-archive
@@ -22,11 +22,11 @@ It has the following command line arguments:
 
 - `--bucket-path`: The S3 bucket path where the documentation will be stored.
 - `--local-path`: The local path where the documentation is stored.
-- `--document-folder`: The folder in the local path where the documentation is 
stored (This is optional if any particular 
+- `--document-folder`: The folder in the local path where the documentation is 
stored (This is optional if any particular
                       folder need to be synced, provide the folder name ex: 
`apache-airflow-providers-amazon`).
 - `--sync-type`: The type of sync to perform. Can be either `last_commit` or 
`full_sync`.
 - `--commit-sha`: The commit sha to sync to S3. This is only required if the 
sync type is `last_commit`.
 
 ```bash
 uv run ./scripts/github_to_s3.py --bucket-path 
s3://staging-docs-airflow-apache-org/docs/ --local-path ./docs-archive 
--sync-type last-commit
-```
\ No newline at end of file
+```

Reply via email to