-
Notifications
You must be signed in to change notification settings - Fork 18
61 lines (53 loc) · 1.73 KB
/
pr-validation.yml
File metadata and controls
61 lines (53 loc) · 1.73 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
name: PR Validation
on:
pull_request:
types: [opened, edited, reopened, synchronize]
jobs:
validate-pr:
name: Validate Pull Request
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: read
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Check PR title
uses: amannn/action-semantic-pull-request@v6
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Check PR description
if: github.event.pull_request.body == ''
run: |
echo "Error: PR description is empty"
exit 1
- name: Check branch name
run: |
BRANCH="${{ github.head_ref }}"
if ! echo "$BRANCH" | grep -qE '^(feature|fix|bugfix|hotfix|docs|chore|refactor|test|release|ci|dependabot)/'; then
echo "Error: Branch name must start with feature/, fix/, bugfix/, hotfix/, docs/, chore/, refactor/, test/, release/, or ci/"
exit 1
fi
- name: Check for merge conflicts
run: |
git fetch origin ${{ github.base_ref }}
if git merge-tree $(git merge-base HEAD origin/${{ github.base_ref }}) HEAD origin/${{ github.base_ref }} | grep -q "^<<<<<<<"; then
echo "Error: Merge conflicts detected"
exit 1
fi
- name: Check file sizes
run: |
if find . -path ./.git -prune -o -type f -size +10M -print | grep -q .; then
echo "Error: Files larger than 10MB found"
exit 1
fi
labeler:
name: Label PR
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- uses: actions/checkout@v6
- uses: actions/labeler@v6