-
-
Notifications
You must be signed in to change notification settings - Fork 16.2k
43 lines (38 loc) · 1.31 KB
/
auto_commands.yml
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
name: Auto AI Commands
on:
pull_request:
types: [opened, reopened, synchronize]
pull_request_target:
types: [opened, reopened, synchronize]
jobs:
check-and-comment:
runs-on: ubuntu-latest
permissions:
pull-requests: write
issues: write
steps:
- name: Check PR status and comment
uses: actions/github-script@v6
with:
script: |
const pr = context.payload.pull_request;
// Check if PR has conflicts
if (pr.mergeable === false) {
console.log('PR has conflicts, commenting /ai resolve');
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: pr.number,
body: '/ai resolve'
});
}
// Check if PR title starts with "updated"
if (pr.title.toLowerCase().startsWith('updated')) {
console.log('PR title starts with "updated", commenting /ai suggest title');
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: pr.number,
body: '/ai suggest title'
});
}