Skip to content

chore(release): fold [Unreleased] into v0.15.0 — the release that goe… #17

chore(release): fold [Unreleased] into v0.15.0 — the release that goe…

chore(release): fold [Unreleased] into v0.15.0 — the release that goe… #17

Workflow file for this run

# Secret scan + MongoModel data check
# ทำงานทุก push + PR — จับ secret ที่หลุดมาก่อน merge
# gitleaks สแกนทุกไฟล์ใน git history (แม้ลบทีหลังก็โดนจับ)
name: Secret Scan
on:
push:
pull_request:
workflow_dispatch:
permissions:
contents: read
pull-requests: write # gitleaks แสดงผลบน PR (เฉพาะที่จำเป็น)
jobs:
gitleaks:
name: Gitleaks secret scan
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # ต้อง history เต็ม — gitleaks สแกนทุก commit ที่ผ่านมา
# gitleaks-action@v2 requires a paid license for organization repos
# (missing GITLEAKS_LICENSE fails every run). The gitleaks CLI itself is
# free (MIT) — download the binary and scan directly instead.
- name: Install gitleaks CLI
run: |
curl -sL https://github.com/gitleaks/gitleaks/releases/download/v8.30.1/gitleaks_8.30.1_linux_x64.tar.gz | tar xz
./gitleaks version
- name: Run Gitleaks
run: |
./gitleaks git . --redact --exit-code 1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
mongomodel-data-check:
name: MongoModel data sanity
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Validate model JSON parses
# hashFiles is only evaluated at step level (after checkout) — job-level
# `if: hashFiles(...)` is rejected by GitHub's parser (workflow fails
# before any job starts). projects.json is tracked, so the file always
# exists in CI; this guard keeps the job a no-op if it ever disappears.
if: hashFiles('mongomodel-data/projects.json') != ''
run: |
node -e "const fs=require('fs');const j=JSON.parse(fs.readFileSync('mongomodel-data/projects.json','utf8'));if(!j.projects)throw new Error('no projects key');console.log('projects.json OK:',Object.keys(j.projects).length,'project(s)')"
- name: Scan mongomodel-data for obvious secrets
if: hashFiles('mongomodel-data/projects.json') != ''
run: |
if grep -rEil 'mongodb(\+srv)?://[^" ]*(:[^"@ ]+@)|BEGIN [A-Z ]*PRIVATE KEY|(ghp|gho|ghu)_[A-Za-z0-9]{36}|github_pat_|sk-(proj-|ant-)[A-Za-z0-9]{10,}|AKIA[0-9A-Z]{16}|xox[baprs]-[A-Za-z0-9-]{10,}|eyJ[A-Za-z0-9_-]{10,}\.' mongomodel-data/; then
echo "::error::Possible secret found in mongomodel-data — do not commit secrets in shared brain"
exit 1
fi
echo "mongomodel-data scan OK"