ludic/.forgejo/workflows/commit-lint.yml
Orkuncakilkaya e3e1bc7784 fix(tools): formatter bracket rules, LSP compiler diagnostics, vocabulary sync
- ludic-fmt: `rows[i]`, `new []int`, `s[a..b]`, `emit(`, `~x`, list-literal
  and query-tag braces stay tight; member calls hug their paren
  (`Date.new(`, `Prefab.spawn(`); `<< >> & | ^ ~` are operators and
  `&& ||` are not — mirrored in ludic_syntax.h, LudicLexer.kt and the
  TextMate grammar. 149 of 274 tracked sources failed --check before.
- ludic-lsp: `initializationOptions.compilerDiagnostics` / `compilerPath`
  are honoured — on save the document's compilation unit is compiled and
  `file:line: error: msg` is published as a "ludicc" diagnostic (the
  option had been documented but never implemented); the workspace scan
  file is per process; bracket codes spelled as char literals
- Overlay added to LUDIC_PHASES, LudicTokens.kt, ludic-mode.el and the
  grammar (the game uses it; check-vocabulary flagged the drift)
- editors: VS Code snippets/package.json/extension.js (`${workspaceFolder}`
  and `~` expansion, PATH lookup, Apache-2.0, real repo URL), Neovim root
  markers, Helix/Zed/Sublime bin/ paths, Emacs vocabulary, JetBrains
  comments; tools/editors/README.md no longer describes C tooling
- .forgejo workflows clone `${{ github.server_url }}/${{ github.repository }}`
  so a fork or mirror tests itself; the docs publish pushes the same way

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-05 01:12:26 +03:00

47 lines
1.7 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
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+$'; 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"