diff --git a/.gitea/workflows/source.yml b/.gitea/workflows/source.yml index f8733e48..60b646c1 100644 --- a/.gitea/workflows/source.yml +++ b/.gitea/workflows/source.yml @@ -23,12 +23,27 @@ jobs: base="$(git merge-base HEAD origin/next)" git diff --check "$base" HEAD python3 - "$base" <<'PY' >> "$GITHUB_OUTPUT" + import os + from pathlib import Path + import re import subprocess import sys changed = subprocess.check_output( ['git', 'diff', '--name-only', '-z', sys.argv[1], 'HEAD'] ).split(b'\0') + pem = re.compile( + rb'^[ \t]*-----BEGIN (?:RSA |EC |OPENSSH )?PRIVATE KEY-----[ \t]*$' + ) + for raw in changed: + path = Path(os.fsdecode(raw)) + if not raw or not path.is_file() or path.is_symlink(): + continue + with path.open('rb') as source: + for number, line in enumerate(source, 1): + if pem.fullmatch(line.rstrip(b'\r\n')): + print(f'private key material: {path}:{number}', file=sys.stderr) + raise SystemExit(1) rust_prefixes = ( b'crates/alkane-core/', b'crates/alkane-discovery/', b'crates/alkane-access/', b'crates/alkane-flash/', diff --git a/.gitea/workflows/verify.yml b/.gitea/workflows/verify.yml index 00c67455..530c9dd9 100644 --- a/.gitea/workflows/verify.yml +++ b/.gitea/workflows/verify.yml @@ -1,14 +1,14 @@ name: verify -# Pre-merge quality gate: clippy + build + tests + microbenchmarks + the headless -# UI self-test, plus a best-effort dependency audit. Runs on pull requests and on -# pushes to any branch EXCEPT main (main is gated by release.yml, which repeats -# these checks before it cuts a release -- so no work is duplicated on main). +# Full quality gate for pull requests to main. The fast source workflow checks +# pull requests to next, and branch workflows build after each merge. on: pull_request: - branches-ignore: [next] - push: - branches-ignore: [main, next] + branches: [main] + +concurrency: + group: alkane-toolkit-verify-${{ github.ref }} + cancel-in-progress: true jobs: verify: