diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index 27c2e43..d56e0ce 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -2,4 +2,67 @@ name: CI on: [push, pull_request] jobs: validate: - uses: molecule-ai/molecule-ci/.gitea/workflows/validate-plugin.yml@main + runs-on: ubuntu-latest + timeout-minutes: 10 + steps: + - uses: actions/checkout@v4 + # Canonical validator script fetched fresh on every run. + # Single source of truth avoids the drift class where validator + # changes weren't propagated to all 21 plugin repos. + # Anonymous git clone to avoid Gitea 1.22.6 auth fallback issue. + - name: Fetch molecule-ci canonical scripts + run: git clone --depth 1 https://git.moleculesai.app/molecule-ai/molecule-ci.git .molecule-ci-canonical + - uses: actions/setup-python@v5 + with: + python-version: "3.11" + cache: "pip" + cache-dependency-path: .molecule-ci-canonical/.molecule-ci/scripts/requirements.txt + - run: pip install pyyaml -q + - run: python3 .molecule-ci-canonical/.molecule-ci/scripts/validate-plugin.py + - name: Check for secrets + run: | + python3 - << 'PYEOF' + import os, re, sys + from pathlib import Path + + PATTERNS = [ + re.compile(r'''["']sk-ant-[a-zA-Z0-9]{50,}["']'''), + re.compile(r'''["']ghp_[a-zA-Z0-9]{36,}["']'''), + re.compile(r'''["']AKIA[A-Z0-9]{16}["']'''), + re.compile(r'''["']Bearer\s+[a-zA-Z0-9_.-]{20,}["']'''), + re.compile(r'''ghp_[a-zA-Z0-9]{36,}'''), + re.compile(r'''sk-ant-[a-zA-Z0-9]{50,}'''), + ] + SKIP_DIRS = {'.molecule-ci', '.molecule-ci-canonical', '.git', 'node_modules', '__pycache__'} + EXTENSIONS = {'.yaml', '.yml', '.md', '.py', '.sh'} + + def is_false_positive(line): + ctx = line.lower() + return '...' in ctx or '