ludic/.forgejo/workflows/commit-lint.yml
Orkuncakilkaya c9ee303b69
All checks were successful
bootstrap / cfree-fixpoint (push) Successful in 22s
ci / build-and-test (push) Successful in 2m51s
commit-lint / conventional-commits (push) Successful in 1s
docs: rewrite the README for someone meeting the language
The README opened with three restatements of "no C", then a limitations table,
then a repo-layout map, and closed with Chrono Rift's keybindings — P2/Mage
`I`/`K` select, `J` confirm — which is a game manual, not a language README. It
never showed the language itself.

It now leads with what Ludic is, a compiling code sample, how to build, what the
language offers, and an honest status. The layout table is contributor material
and CONTRIBUTING already covers that ground.

Two things were not merely stylistic:

- Nine links pointed at wiki pages that no longer exist.
- "Language at a glance" advertised `system` with `reads`/`writes`, plus
  `requires`/`ensures`. None of those are keywords — the grammar has `handler`,
  and `System.*` is a namespace. That bullet described a vocabulary retired
  several releases ago.

The sample is verified to compile, every internal link resolves, and every
command named is one `x help` actually offers.

Also makes commit-lint survive a force-push: it linted `event.before..sha`
without checking that `before` still resolves, so rewriting or gc'ing that
commit failed the job with "Invalid revision range" on a push whose messages
were all valid.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-05 14:25:07 +03:00

52 lines
2.1 KiB
YAML

name: commit-lint
# Enforce Conventional Commits in CI, as a backstop to the local commit-msg hook
# (which a contributor only gets after `git config core.hooksPath tools/git-hooks`).
# Lints every new commit's summary line against tools/git-hooks/lib.sh — the same
# rule the hook uses, so the two can never drift.
on:
push:
branches: [main]
pull_request:
workflow_dispatch: {}
jobs:
conventional-commits:
runs-on: docker
container: node:20-bookworm
steps:
- name: Check out with history
env:
REPO_URL: ${{ github.server_url }}/${{ github.repository }}.git
run: |
set -eu
git config --global --add safe.directory '*'
# Full clone so both endpoints of the range are present.
git clone "$REPO_URL" .
git checkout "${GITHUB_SHA}" 2>/dev/null || git checkout "${GITHUB_REF_NAME:-main}"
- name: Lint the new commits
env:
BEFORE: ${{ github.event.before }}
BASE: ${{ github.base_ref }}
run: |
set -eu
# Pick the range of *new* commits to lint:
# - pull_request: base branch .. this commit
# - push: the pushed range (event.before .. this commit)
# - new branch / unknown: just the tip commit
# `event.before` is only usable if it still resolves: a force-push
# rewrites (and a gc can remove) the commit it names, which made this
# job fail with "Invalid revision range" on an otherwise clean push.
# Fall back to the tip commit in that case.
if [ -n "${BASE:-}" ]; then
git fetch --quiet origin "${BASE}" 2>/dev/null || true
RANGE="origin/${BASE}..${GITHUB_SHA}"
elif [ -n "${BEFORE:-}" ] && ! printf '%s' "$BEFORE" | grep -qE '^0+$' \
&& git cat-file -e "${BEFORE}^{commit}" 2>/dev/null; then
RANGE="${BEFORE}..${GITHUB_SHA}"
else
RANGE="${GITHUB_SHA}~1..${GITHUB_SHA}"
fi
echo "linting range: $RANGE"
sh tools/git-hooks/lint-range.sh "$RANGE"