-
Notifications
You must be signed in to change notification settings - Fork 0
75 lines (63 loc) · 2.08 KB
/
pr.yml
File metadata and controls
75 lines (63 loc) · 2.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
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 }}