Pull requests only, squash-merged, titled as conventional commits (checked); release-bot keeps a chore(release) pull request open, worked out by git-cliff, and merging it tags the release. Co-Authored-By: Claude Opus 5.5 <[email protected]>
31 lines
1.4 KiB
YAML
31 lines
1.4 KiB
YAML
# A pull request's title becomes its commit on main (squash merges, .gitea/default_merge_message), so it must be a
|
|
# conventional commit: the release workflow versions releases and writes the changelog from them. Required to merge
|
|
# (branch protection, dhkatz/infra modules/app-repo).
|
|
name: Pull request
|
|
|
|
on:
|
|
pull_request:
|
|
types: [opened, edited, reopened, synchronize]
|
|
|
|
jobs:
|
|
title:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Conventional commit title
|
|
env:
|
|
TITLE: ${{ github.event.pull_request.title }}
|
|
BRANCH: ${{ github.head_ref }}
|
|
AUTHOR: ${{ github.event.pull_request.user.login }}
|
|
run: |
|
|
types="feat|fix|perf|refactor|docs|test|build|ci|chore|style|revert"
|
|
conventional="^($types)(\([a-z0-9][a-z0-9./_-]*\))?!?: [^ ]"
|
|
if ! [[ "$TITLE" =~ $conventional ]]; then
|
|
echo "::error::The title becomes the commit on main, so it must be a conventional commit: type(scope): summary, e.g. \"feat(api): room bans\" or \"fix: crash on an empty catalog\" (! before the colon for a breaking change). Types: ${types//|/, }."
|
|
exit 1
|
|
fi
|
|
if [[ "$TITLE" =~ ^chore\(release\) ]] && [[ "$BRANCH" != release || "$AUTHOR" != release-bot ]]; then
|
|
echo "::error::chore(release) is release-bot's: merging its release pull request is what tags a release."
|
|
exit 1
|
|
fi
|
|
echo "OK: $TITLE"
|