From 8532e38151c5133dd09241c0a43a2a309e3cb265 Mon Sep 17 00:00:00 2001 From: kasun Date: Mon, 23 Nov 2026 05:08:47 +0100 Subject: [PATCH] chore(ci): add secret scan and lint checks --- .ansible-lint | 5 ++++ .gitea/workflows/checks.yaml | 55 ++++++++++++++++++++++++++++++++++++ .yamllint.yml | 22 +++++++++++++++ requirements-dev.txt | 2 ++ 4 files changed, 84 insertions(+) create mode 100644 .ansible-lint create mode 100644 .gitea/workflows/checks.yaml create mode 100644 .yamllint.yml create mode 100644 requirements-dev.txt diff --git a/.ansible-lint b/.ansible-lint new file mode 100644 index 0000000..98393ef --- /dev/null +++ b/.ansible-lint @@ -0,0 +1,5 @@ +profile: production + +exclude_paths: + - .gitea/ + - stacks/ diff --git a/.gitea/workflows/checks.yaml b/.gitea/workflows/checks.yaml new file mode 100644 index 0000000..7769a3a --- /dev/null +++ b/.gitea/workflows/checks.yaml @@ -0,0 +1,55 @@ +name: Checks + +on: + workflow_dispatch: + push: + branches: + - main + pull_request: + branches: + - main + +env: + BETTERLEAKS_VERSION: "1.10.1" + BETTERLEAKS_SHA256: c174b42d7aa60caf58c0c3e555c0e4bed01fe6b0d99a412bce777b5af4ce913e + +jobs: + secret-scan: + name: Secret Scan + runs-on: ubuntu-latest + steps: + - name: Checkout Full History + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Install Betterleaks + run: | + curl -fsSL -o /tmp/betterleaks.tar.gz \ + "https://github.com/betterleaks/betterleaks/releases/download/v${BETTERLEAKS_VERSION}/betterleaks_${BETTERLEAKS_VERSION}_linux_x64.tar.gz" + echo "${BETTERLEAKS_SHA256} /tmp/betterleaks.tar.gz" | sha256sum -c - + tar -xzf /tmp/betterleaks.tar.gz -C /tmp betterleaks + + - name: Scan Git History + run: /tmp/betterleaks git . --redact --verbose --no-banner --no-color --log-opts="--all -m -p -U0" + + lint: + name: Lint + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Python + uses: actions/setup-python@v5 + with: + python-version: "3.14" + + - name: Install Lint Tools + run: pip install -r requirements-dev.txt + + - name: Run yamllint + run: yamllint --strict . + + - name: Run ansible-lint + run: ansible-lint diff --git a/.yamllint.yml b/.yamllint.yml new file mode 100644 index 0000000..f631cbf --- /dev/null +++ b/.yamllint.yml @@ -0,0 +1,22 @@ +extends: default + +ignore: | + .venv/ + .ansible/ + collections/ansible_collections/ + +rules: + # These four settings are the values ansible-lint requires. + braces: + max-spaces-inside: 1 + comments: + min-spaces-from-content: 1 + comments-indentation: false + octal-values: + forbid-implicit-octal: true + forbid-explicit-octal: true + document-start: disable + line-length: + max: 120 + truthy: + check-keys: false diff --git a/requirements-dev.txt b/requirements-dev.txt new file mode 100644 index 0000000..ce81722 --- /dev/null +++ b/requirements-dev.txt @@ -0,0 +1,2 @@ +ansible-lint==26.11.0 +yamllint==1.38.0