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
27 changes: 27 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: ci

on:
pull_request:
merge_group:
push:
branches:
- main

permissions:
contents: read

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7.0.0
with:
fetch-depth: 0
Comment thread
coderabbitai[bot] marked this conversation as resolved.
persist-credentials: false
- name: Test commit message checker
run: python3 check-commit-messages/test_check.py
- name: Check commit messages
if: github.event_name == 'pull_request'
uses: ./check-commit-messages
with:
base_ref: ${{ github.event.pull_request.base.ref }}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
__pycache__/
*.pyc
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# GitHub Actions

Shared GitHub Actions for Airlift projects.

## Available actions

### Check commit messages

Checks pull request commit titles, description wrapping, and attribution
trailers. See [check-commit-messages](check-commit-messages/README.md) for
usage and policy details.
34 changes: 34 additions & 0 deletions check-commit-messages/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Check commit messages

Checks every non-merge commit in a pull request.

## Policy

- Commit titles should be at most 50 characters and must not exceed 60.
Comment thread
coderabbitai[bot] marked this conversation as resolved.
- Commit descriptions should wrap at 72 characters. Ordinary text must not
exceed 79 characters.
- `Assisted-by` and `Co-authored-by` trailers must not credit common AI models
or coding tools. Human attribution remains allowed.

Long URLs, recognized trailers, quoted text, fenced code blocks, and long
unwrappable tokens are exempt from description wrapping.

## Usage

The action requires a checkout with complete history:

```yaml
check-commit-messages:
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7.0.0
with:
fetch-depth: 0
persist-credentials: false
- uses: airlift/github-actions/check-commit-messages@<commit-sha> # v1
with:
base_ref: ${{ github.event.pull_request.base.ref }}
```

Consumers should pin the action to a complete commit SHA.
22 changes: 22 additions & 0 deletions check-commit-messages/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Check commit messages
description: Check commit title length, description wrapping, and attribution trailers

inputs:
base_ref:
description: Pull request base branch
required: true

runs:
using: composite
steps:
- name: Check commit messages
shell: bash
env:
BASE_REF: ${{ inputs.base_ref }}
run: |
if [[ ! "$BASE_REF" =~ ^[A-Za-z0-9._/-]+$ ]]; then
echo "Invalid pull request base ref: $BASE_REF" >&2
exit 1
fi
python3 "${{ github.action_path }}/check.py" \
"origin/${BASE_REF}..HEAD"
Loading