Skip to content
Merged
78 changes: 78 additions & 0 deletions .github/mergify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
pull_request_rules:
- name: Enforce branch naming convention
description: Branch must follow <type>/<description> or <username>/<description> format
conditions:
- head ~!= ^[a-z0-9]([a-z0-9._-]*[a-z0-9])?/[a-z0-9._-]+$
Comment thread
CatherineSue marked this conversation as resolved.
Resolved
- head != main
actions:
comment:
message: |
Hi @{{author}}, the branch `{{head}}` does not follow our naming convention.

Please use one of the following formats:
- `<type>/<description>` — e.g. `feat/add-auth`, `fix/null-pointer`
- `<username>/<description>` — e.g. `changsu/fix-routing`

Allowed types: `feat`, `fix`, `chore`, `docs`, `refactor`, `test`, `ci`, `perf`
post_check:
title: Branch naming convention
summary: |
Branch `{{head}}` does not match the required pattern: `<type>/<description>` or `<username>/<description>`.
close:
message: |
Closing this PR because the branch name does not follow the naming convention. Please rename your branch and reopen.
Comment thread
CatherineSue marked this conversation as resolved.
Resolved

- name: Comment on DCO check failure
description: Post fix instructions when DCO sign-off is missing
conditions:
- check-failure = dco-check
- -closed
- -draft
actions:
comment:
message: |
Hi @{{author}}, the DCO sign-off check has failed. All commits must include a `Signed-off-by` line.

**To fix existing commits:**
```bash
# Sign off the last N commits (replace N with the number of unsigned commits)
git rebase HEAD~N --signoff
git push --force-with-lease
```

**To sign off future commits automatically:**
- Use `git commit -s` every time, or
- **VSCode**: enable `Git: Always Sign Off` in Settings
- **PyCharm**: enable `Sign-off commit` in the Commit tool window

- name: Notify on merge conflicts
description: Comment when a PR has merge conflicts
conditions:
- conflict
- -closed
- -draft
actions:
comment:
message: |
Hi @{{author}}, this PR has merge conflicts that must be resolved before it can be merged. Please rebase your branch:
```bash
git fetch origin main
git rebase origin/main
# resolve any conflicts, then:
git push --force-with-lease
```

- name: Remind on stale PRs
description: Comment and label PRs inactive for 14 days
conditions:
- updated-at < 14 days ago
- -merged
- -closed
- -draft
actions:
comment:
message: |
Hi @{{author}}, this PR has been inactive for 14 days. Please update it or close it if it's no longer needed.
label:
add:
- stale
22 changes: 20 additions & 2 deletions .github/workflows/pr-test-rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,24 @@ env:
GENAI_BENCH_IMAGE: ghcr.io/moirai-internal/genai-bench:0.0.3

jobs:
dco-check:
if: github.event_name == 'pull_request'
runs-on: k8s-runner-cpu
permissions:
contents: read
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Get PR commits
id: get-commits
uses: tim-actions/get-pr-commits@master
with:
token: ${{ secrets.GITHUB_TOKEN }}
- uses: tim-actions/dco@master
with:
commits: ${{ steps.get-commits.outputs.commits }}
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved

check-ci:
runs-on: k8s-runner-cpu
permissions:
Expand Down Expand Up @@ -586,7 +604,7 @@ jobs:
path: benchmark_go_bindings/

finish:
needs: [check-ci, python-lint, grpc-proto-build-check, build-wheel, python-unit-tests, unit-tests, gateway-e2e, go-unit-tests, go-bindings-e2e]
needs: [dco-check, check-ci, python-lint, grpc-proto-build-check, build-wheel, python-unit-tests, unit-tests, gateway-e2e, go-unit-tests, go-bindings-e2e]
if: always()
runs-on: k8s-runner-cpu
permissions: {}
Expand All @@ -596,7 +614,7 @@ jobs:
if [[ "${{ needs.check-ci.outputs.should_run }}" != "true" ]]; then
echo "CI was skipped (external contributor without run-ci label)"
exit 0
elif [[ "${{ needs.python-lint.result }}" == "failure" || "${{ needs.grpc-proto-build-check.result }}" == "failure" || "${{ needs.build-wheel.result }}" == "failure" || "${{ needs.python-unit-tests.result }}" == "failure" || "${{ needs.unit-tests.result }}" == "failure" || "${{ needs.gateway-e2e.result }}" == "failure" || "${{ needs.go-unit-tests.result }}" == "failure" || "${{ needs.go-bindings-e2e.result }}" == "failure" ]]; then
elif [[ "${{ needs.dco-check.result }}" == "failure" || "${{ needs.python-lint.result }}" == "failure" || "${{ needs.grpc-proto-build-check.result }}" == "failure" || "${{ needs.build-wheel.result }}" == "failure" || "${{ needs.python-unit-tests.result }}" == "failure" || "${{ needs.unit-tests.result }}" == "failure" || "${{ needs.gateway-e2e.result }}" == "failure" || "${{ needs.go-unit-tests.result }}" == "failure" || "${{ needs.go-bindings-e2e.result }}" == "failure" ]]; then
echo "One or more jobs failed"
exit 1
else
Expand Down
17 changes: 17 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,23 @@ repos:
types: [rust]
pass_filenames: false

- id: branch-name-check
name: Branch naming convention
description: Ensure branch name follows <type>/<desc> or <username>/<desc> format
entry: bash -c 'branch=$(git rev-parse --abbrev-ref HEAD); [[ "$branch" == "main" || "$branch" =~ ^[a-z0-9]([a-z0-9._-]*[a-z0-9])?/[a-z0-9._-]+$ ]] || { echo "Branch \"$branch\" does not follow naming convention: <type>/<description> or <username>/<description>"; exit 1; }'
Comment thread
CatherineSue marked this conversation as resolved.
Resolved
language: system
stages: [pre-push]
always_run: true
pass_filenames: false
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved

- id: dco-check
name: DCO sign-off check
description: Check that the commit message contains a DCO sign-off
entry: bash -c 'grep -q "^Signed-off-by: .* <.*>" "$1"' --
Comment thread
CatherineSue marked this conversation as resolved.
Resolved
language: system
stages: [commit-msg]
always_run: true

Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.15.0
hooks:
Expand Down
14 changes: 14 additions & 0 deletions docs/contributing/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,22 @@ Python code in `e2e_test/`, `bindings/python/`, and `scripts/` is checked with
```bash
pip install pre-commit
pre-commit install
pre-commit install --hook-type commit-msg # enables DCO sign-off check
```

### DCO Sign-Off

All commits must include a `Signed-off-by` line ([Developer Certificate of Origin](https://developercertificate.org/)).
Use the `-s` flag when committing:

```bash
git commit -s -m "feat: add new feature"
```

This adds a line like `Signed-off-by: Your Name <your@email.com>` using your
`user.name` and `user.email` from git config. The pre-commit `commit-msg` hook
and CI will both reject commits without it.

To run checks manually:

```bash
Expand Down
Loading