From 0a0a5b88af43fc413458ba0e1d970ad3c6196fdd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl-Einar=20Bergstr=C3=B8m?= Date: Mon, 12 Oct 2026 21:59:01 +0200 Subject: [PATCH] ci: check pull request titles (#3) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Copies `pr-title.yml` from lazysecrets: a pull request title must start with a conventional commit type (`feat: …`, `fix(scope): …`, `[feat] …`). Pull requests are squash-merged, so the title becomes the commit on main. Keeping those conventional means release notes can be written from main's history later (git-cliff, as lazysecrets does). Once merged, `PR title / *` gets added to main's required checks. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Reviewed-on: https://git.kebcloud.no/keb/lazysecrets.nvim/pulls/3 Co-authored-by: Karl-Einar Bergstrøm --- .gitea/workflows/pr-title.yml | 40 +++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 .gitea/workflows/pr-title.yml diff --git a/.gitea/workflows/pr-title.yml b/.gitea/workflows/pr-title.yml new file mode 100644 index 0000000..da24c58 --- /dev/null +++ b/.gitea/workflows/pr-title.yml @@ -0,0 +1,40 @@ +name: PR title + +# Pull requests are squash-merged, so the title becomes the commit on main: +# it must start with a conventional commit type, so that release notes can +# be written from main's history (git-cliff, as lazysecrets does). Brackets +# and a missing space are fine too. +# +# feat: SOPS and .env files in git repos +# fix(search): ctrl+r with empty results loads the scope +# feat!: rename config keys (! marks a breaking change) +# [feat] install with a one-liner +# [fix]: hide values on blur +# docs:split the README + +on: + pull_request: + branches: [main] + types: [opened, edited, reopened, synchronize] + +jobs: + title: + name: Conventional title + runs-on: ubuntu-latest + steps: + - name: Check the title + env: + TITLE: ${{ github.event.pull_request.title }} + run: | + types='feat|fix|perf|refactor|docs|test|ci|chore|build|style|revert' + scope='(\([a-z0-9._/-]+\))?' + if [[ "$TITLE" =~ ^\[($types)$scope!?\]!?:?[[:space:]]*(.*)$ ]] || + [[ "$TITLE" =~ ^($types)$scope!?:[[:space:]]*(.*)$ ]]; then + what="${BASH_REMATCH[3]}" + fi + if [[ "${what:-}" =~ [^[:space:]] ]]; then + echo "ok: $TITLE" + else + echo "::error::The title should start with a type, like \"feat: what changed\" or \"[feat] what changed\"; types: ${types//|/, }. Got: $TITLE" + exit 1 + fi