-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathadvanced-custom-triggers.yml
More file actions
119 lines (112 loc) · 4.68 KB
/
advanced-custom-triggers.yml
File metadata and controls
119 lines (112 loc) · 4.68 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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
# Advanced Custom Trigger Conditions Example
# This example demonstrates using custom_trigger_condition for advanced use cases
# beyond the default @claude mention detection.
name: Advanced Claude Integration with Custom Triggers
# Concurrency control to prevent multiple jobs running for the same PR/issue
concurrency:
group: claude-${{ github.event.pull_request.number || github.event.issue.number || 'manual' }}
cancel-in-progress: false
on:
workflow_dispatch:
inputs:
test_mode:
description: 'Test mode for debugging'
required: false
type: boolean
default: false
issue_comment:
types: [created]
pull_request_review_comment:
types: [created]
issues:
types: [opened, assigned]
pull_request_review:
types: [submitted]
pull_request:
types: [opened, synchronize]
jobs:
# Example 1: Custom trigger for urgent issues only
claude-urgent-issues:
uses: dotCMS/ai-workflows/.github/workflows/[email protected]
with:
trigger_mode: interactive
# Custom condition: Only trigger for issues labeled as "urgent" or "critical"
custom_trigger_condition: |
github.event_name == 'issues' && (
contains(github.event.issue.labels.*.name, 'urgent') ||
contains(github.event.issue.labels.*.name, 'critical') ||
contains(github.event.issue.labels.*.name, 'P0')
)
claude_args: '--allowedTools "Bash(git status),Bash(git diff)"'
timeout_minutes: 10
runner: ubuntu-latest
enable_mention_detection: false # Disable default @claude detection since we have custom logic
secrets:
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
# Example 2: Custom trigger for specific file changes
claude-config-changes:
uses: dotCMS/ai-workflows/.github/workflows/[email protected]
with:
trigger_mode: automatic
# Custom condition: Only trigger for PRs that modify configuration files
custom_trigger_condition: |
github.event_name == 'pull_request' && (
contains(github.event.pull_request.title, '[config]') ||
contains(github.event.pull_request.body, 'configuration') ||
github.event.pull_request.changed_files > 10
)
prompt: |
This PR appears to modify configuration files or has many changes.
Please review for:
- Configuration syntax and validity
- Potential breaking changes
- Security implications of config changes
- Impact on existing functionality
claude_args: '--allowedTools "Bash(git status),Bash(git diff),Bash(grep -r \"config\" .)"'
timeout_minutes: 15
runner: ubuntu-latest
enable_mention_detection: false
secrets:
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
# Example 3: Custom trigger combining multiple conditions
claude-security-review:
uses: dotCMS/ai-workflows/.github/workflows/[email protected]
with:
trigger_mode: automatic
# Custom condition: Security-related changes or mentions
custom_trigger_condition: |
(github.event_name == 'pull_request' && (
contains(github.event.pull_request.title, 'security') ||
contains(github.event.pull_request.title, 'auth') ||
contains(github.event.pull_request.body, 'vulnerability') ||
contains(github.event.pull_request.body, 'CVE-')
)) ||
(github.event_name == 'issue_comment' && (
contains(github.event.comment.body, 'security review') ||
contains(github.event.comment.body, '@security-team')
))
prompt: |
This appears to be a security-related change. Please provide a thorough security review focusing on:
- Authentication and authorization mechanisms
- Input validation and sanitization
- Potential security vulnerabilities
- Compliance with security best practices
- Impact on existing security controls
claude_args: '--allowedTools "Bash(git status),Bash(git diff)"'
timeout_minutes: 20
runner: ubuntu-latest
enable_mention_detection: false
secrets:
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
# Example 4: Fallback with default @claude mention detection
claude-general:
uses: dotCMS/ai-workflows/.github/workflows/[email protected]
with:
trigger_mode: interactive
# No custom condition - will use default @claude mention detection
claude_args: '--allowedTools "Bash(git status),Bash(git diff)"'
timeout_minutes: 15
runner: ubuntu-latest
enable_mention_detection: true # Use default @claude mention detection
secrets:
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}