-
Notifications
You must be signed in to change notification settings - Fork 41
76 lines (71 loc) · 2.31 KB
/
Copy pathpr-title-lint.yml
File metadata and controls
76 lines (71 loc) · 2.31 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
76
name: PR Title Lint
on:
pull_request:
types: [opened, edited, synchronize, reopened, ready_for_review]
jobs:
lint-pr-title:
name: "Check PR title format"
runs-on: warp-ubuntu-2604-x64-2x
permissions:
contents: read
if: github.event_name == 'pull_request' || github.event_name == 'merge_group'
steps:
- uses: amannn/action-semantic-pull-request@48f256284bd46cdaab1048c3721360e808335d50 # v6.1.1
with:
types: |
feat
fix
chore
docs
style
refactor
perf
test
build
ci
revert
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
check-pr-title-type:
name: "Validate title type matches changes"
runs-on: warp-ubuntu-2604-x64-2x
permissions:
contents: read
pull-requests: write
issues: read
id-token: write
if: github.event_name == 'pull_request' && !github.event.pull_request.draft
steps:
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 1
persist-credentials: false
- name: Build prompt with PR title and changed files
id: build-prompt
env:
PR_TITLE: ${{ github.event.pull_request.title }}
PR_NUMBER: ${{ github.event.pull_request.number }}
GH_TOKEN: ${{ github.token }}
run: |
FILES=$(gh pr diff "$PR_NUMBER" --name-only)
DELIM="PROMPT_EOF_$(uuidgen)"
{
echo "TITLE_CHECK_PROMPT<<$DELIM"
printf 'PR TITLE: %s\n' "$PR_TITLE"
printf 'PR NUMBER: %s\n' "$PR_NUMBER"
echo ""
echo "CHANGED FILES:"
echo "$FILES"
echo ""
cat .github/prompts/pr-title-check.prompt.md
echo "$DELIM"
} >> "$GITHUB_ENV"
- name: Validate title type matches changes
env:
GH_TOKEN: ${{ github.token }}
uses: anthropics/claude-code-action@459ad358ae43fea66bfefd0a1f8d840b4b9791fb # v1.0.194
with:
anthropic_api_key: ${{ secrets.ANTHROPIC_API }}
prompt: ${{ env.TITLE_CHECK_PROMPT }}
claude_args: '--model claude-haiku-4-5 --allowed-tools "Bash(gh pr comment:*)"'