the-custodian/.forgejo/workflows/generated-commit-guard.yaml
custodian-sync 6fe7201fd5
All checks were successful
CI Smoke / host-smoke (push) Successful in 0s
CI Smoke / container-smoke (push) Successful in 1s
Reject generated-only commits / generated-commit-guard (push) Successful in 7s
Python Tests / pytest (push) Successful in 25s
chore(consistency): sync task status from DB [auto]
Updated by fix-consistency on 2026-10-11:
  - update .custodian-brief.md for the-custodian
2026-10-11 21:30:44 +02:00

33 lines
1.1 KiB
YAML

name: Reject generated-only commits
on:
push:
branches: [main]
pull_request:
workflow_dispatch:
jobs:
generated-commit-guard:
runs-on: ubuntu-latest
steps:
- name: Check every proposed commit
env:
PUSH_BEFORE: ${{ github.event.before }}
PR_BASE: ${{ github.event.pull_request.base.sha }}
HEAD_SHA: ${{ github.sha }}
run: |
set -eu
apt-get update -qq >/dev/null
apt-get install -y -qq git python3 >/dev/null
WORK="$(mktemp -d)"
trap 'rm -rf "$WORK"' EXIT
git clone --quiet "https://forgejo.coulomb.social/${GITHUB_REPOSITORY}.git" "$WORK/repo"
cd "$WORK/repo"
git fetch --quiet origin "$HEAD_SHA"
git checkout --quiet --detach "$HEAD_SHA"
BASE="${PR_BASE:-${PUSH_BEFORE:-}}"
if [ -z "$BASE" ] || [ "$BASE" = 0000000000000000000000000000000000000000 ]; then
BASE="$(git rev-parse HEAD^)"
fi
git fetch --quiet origin "$BASE"
python3 scripts/check_generated_only_commit.py --range "$BASE..$HEAD_SHA"