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

dahn pushed a commit to branch staging-site
in repository https://gitbox.apache.org/repos/asf/cloudstack-www.git


The following commit(s) were added to refs/heads/staging-site by this push:
     new 0d9380e99 Add `pre-commit` and the `trailing-whitespace` hook (#241)
0d9380e99 is described below

commit 0d9380e99b5c719b699ab8e527a08e6897888444
Author: John Bampton <[email protected]>
AuthorDate: Wed Sep 18 18:58:52 2024 +1000

    Add `pre-commit` and the `trailing-whitespace` hook (#241)
---
 .github/workflows/lint.yml | 47 ++++++++++++++++++++++++++++++++++++++++++++
 .pre-commit-config.yaml    | 49 ++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 96 insertions(+)

diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml
new file mode 100644
index 000000000..75c388934
--- /dev/null
+++ b/.github/workflows/lint.yml
@@ -0,0 +1,47 @@
+#  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.
+
+name: Lint
+
+on: [pull_request]
+
+permissions:  # added using https://github.com/step-security/secure-workflows
+  contents: read
+
+jobs:
+  pre-commit:
+    name: Run pre-commit  # https://pre-commit.com/
+    runs-on: ubuntu-latest
+    steps:
+      - name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )"
+        uses: actions/checkout@v4
+      - uses: actions/setup-python@v5  # https://www.python.org/
+        with:
+          python-version: '3.x'  # Version range or exact version of a Python 
version to use, using SemVer's version range syntax
+          architecture: 'x64'  # optional x64 or x86. Defaults to x64 if not 
specified
+      - name: Install dependencies  # https://pip.pypa.io/en/stable/
+        run: |
+          python -m pip install --upgrade pip
+          pip install pre-commit
+      - name: Set PY
+        run: echo "PY=$(python -VV | sha256sum | cut -d' ' -f1)" >> 
"$GITHUB_ENV"
+      - uses: actions/cache@v4
+        with:
+          path: ~/.cache/pre-commit
+          key: pre-commit|${{ env.PY }}|${{ 
hashFiles('.pre-commit-config.yaml') }}
+      - name: Run pre-commit
+        run: pre-commit run --all-files
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
new file mode 100644
index 000000000..921dfb349
--- /dev/null
+++ b/.pre-commit-config.yaml
@@ -0,0 +1,49 @@
+#  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.
+---
+# https://pre-commit.com/#installation
+default_stages: [commit, push]
+default_language_version:
+  # force all unspecified Python hooks to run python3
+  python: python3
+minimum_pre_commit_version: '2.18.1'
+repos:
+  - repo: meta
+    hooks:
+      - id: identity
+      - id: check-hooks-apply
+  - repo: https://github.com/pre-commit/pre-commit-hooks
+    rev: v4.6.0
+    hooks:
+      #- id: check-added-large-files
+      #- id: check-case-conflict
+      #- id: check-executables-have-shebangs
+      #- id: check-merge-conflict
+      #- id: check-shebang-scripts-are-executable
+      #- id: check-vcs-permalinks
+      #- id: check-yaml
+      #- id: destroyed-symlinks
+      #- id: detect-aws-credentials
+      #  args: [--allow-missing-credentials]
+      #- id: detect-private-key
+      #- id: end-of-file-fixer
+      #- id: fix-byte-order-marker
+      #- id: forbid-submodules
+      #- id: mixed-line-ending
+      - id: trailing-whitespace
+        args: [--markdown-linebreak-ext=md]
+        exclude: ^static/.*$

Reply via email to