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

on:
pull_request:
types: [opened, edited, synchronize, reopened]
branches:
- main

permissions:
contents: read
pull-requests: write

jobs:
title:
runs-on: ubuntu-latest
steps:
- name: Validate PR title follows Conventional Commits
env:
TITLE: ${{ github.event.pull_request.title }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
if echo "$TITLE" | grep -qE "^(feat|fix|docs|style|refactor|test|chore|build|ci|perf|revert)(\(.+\))?(!)?: .+"; then
echo "PR title is valid: $TITLE"
exit 0
fi

BODY=$(cat <<'COMMENT'
### ⚠️ Invalid PR Title

PR title must follow the **Conventional Commits** format since we use squash merge:

```
<type>[optional scope][!]: <description>
```

**Allowed types:** `feat`, `fix`, `docs`, `style`, `refactor`, `test`, `chore`, `build`, `ci`, `perf`, `revert`

**Examples:**
- `feat: add new feature`
- `fix(api): resolve null pointer`
- `feat!: breaking change`
- `chore(deps): update dependencies`
COMMENT
)

# Post comment on PR
gh api "repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/comments" \
-X POST -f body="$BODY"

echo "::error::PR title must follow Conventional Commits format"
exit 1

review:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: AxeForging/reviewforge@main
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
AI_PROVIDER: gemini
AI_MODEL: gemini-2.5-flash
AI_API_KEY: ${{ secrets.GEMINI_API_KEY }}
SHOW_TOKEN_USAGE: true
INCREMENTAL: false
REVIEW_RULES: concise

validate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: AxeForging/structlint@main
with:
config: .structlint.yaml
comment-on-pr: "true"
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
33 changes: 28 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ on:
workflow_dispatch:
inputs:
tag:
description: 'Release tag (e.g., v1.0.0)'
required: true
description: 'Release tag (leave empty for auto-bump from conventional commits)'
required: false
type: string

permissions:
Expand All @@ -29,15 +29,38 @@ jobs:
- name: Run tests
run: go test ./... -v

- name: Determine version
id: version
uses: AxeForging/releaseforge@main
with:
command: bump

- name: Set tag
id: tag
run: |
if [ -n "${{ inputs.tag }}" ]; then
echo "tag=${{ inputs.tag }}" >> "$GITHUB_OUTPUT"
else
echo "tag=${{ steps.version.outputs.next-version }}" >> "$GITHUB_OUTPUT"
fi

- name: Generate release notes
id: notes
uses: AxeForging/releaseforge@main
with:
command: generate
api-key: ${{ secrets.GEMINI_API_KEY }}

- name: Create and push tag
run: |
git tag ${{ inputs.tag }}
git push origin ${{ inputs.tag }}
echo "Releasing ${{ steps.tag.outputs.tag }}"
git tag ${{ steps.tag.outputs.tag }}
git push origin ${{ steps.tag.outputs.tag }}

- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v6
with:
version: latest
args: release --clean
args: release --clean --release-notes ${{ steps.notes.outputs.release-notes }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
26 changes: 0 additions & 26 deletions .github/workflows/review.yml

This file was deleted.

22 changes: 0 additions & 22 deletions .github/workflows/validate.yml

This file was deleted.

2 changes: 1 addition & 1 deletion lefthook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ commit-msg:
run: |
msg=$(cat {1})
# Check for conventional commit format
if ! echo "$msg" | grep -qE "^(feat|fix|docs|style|refactor|test|chore|build|ci|perf|revert)(\(.+\))?: .+"; then
if ! echo "$msg" | grep -qE "^(feat|fix|docs|style|refactor|test|chore|build|ci|perf|revert)(\(.+\))?(!)?: .+"; then
echo "Error: Commit message must follow conventional commits format"
echo "Examples:"
echo " feat: add new feature"
Expand Down