Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions .github/workflows/branch-name.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: branch-name
# Contributions reach master only through a pull request from feature/<name>, <name> being
# Contributions reach master only through a pull request from <type>/<name>, <type> being a
# Conventional Commit type and <name>
# at least three lowercase words joined by single hyphens. master's ruleset requires this
# check; the maintainer can bypass it.
# Dependabot's own dependabot/... branches pass when Dependabot opened the pull request.
Expand All @@ -11,16 +12,16 @@ jobs:
branch-name:
runs-on: ubuntu-latest
steps:
- name: feature/<three-or-more-words> into master
- name: <type>/<three-or-more-words> into master
env: { HEAD: "${{ github.head_ref }}", AUTHOR: "${{ github.event.pull_request.user.login }}" }
run: |
if [ "$AUTHOR" = "dependabot[bot]" ] && printf '%s' "$HEAD" | grep -Eq '^dependabot/'; then
echo "ok: dependency update $HEAD"
exit 0
fi
if printf '%s' "$HEAD" | grep -Eq '^feature/[a-z0-9]+(-[a-z0-9]+){2,}$'; then
if printf '%s' "$HEAD" | grep -Eq '^(feat|fix|perf|refactor|docs|test|build|ci|chore|style|revert)/[a-z0-9]+(-[a-z0-9]+){2,}$'; then
echo "ok: $HEAD"
else
echo "::error::branch '$HEAD' must be named feature/<name>, <name> being at least three lowercase words joined by single hyphens (letters and digits only), e.g. feature/fix-windows-install"
echo "::error::branch '$HEAD' must be named <type>/<name>, <type> being one of feat, fix, perf, refactor, docs, test, build, ci, chore, style, revert and <name> at least three lowercase words joined by single hyphens (letters and digits only), e.g. fix/windows-install-paths"
exit 1
fi
5 changes: 3 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ contribution public under the AGPL.
## Branches and pull requests

`master` takes changes only through a pull request, from the maintainer too. Name your branch
`feature/<name>`, where the name is at least three lowercase words joined by hyphens (letters
and digits only, no underscores or dots), for example `feature/fix-windows-install`, and open
`<type>/<name>`: `<type>` is the Conventional Commit type of the change (`feat`, `fix`, `perf`, `refactor`, `docs`, `test`, `build`, `ci`, `chore`, `style` or `revert`), and the
name is at least three lowercase words joined by hyphens (letters and digits only, no
underscores or dots), for example `fix/windows-install-paths`. `feature/` is not a type. Open
the pull request against `master`. A check fails any other branch name, and a pull
request merges after the maintainer approves it.

Expand Down
Loading