Skip to content

Commit efdd5ee

Browse files
Add GitHub Action to auto-assign Devin PRs to requesting users (#927)
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: Itamar Hartstein <haritamar@gmail.com>
1 parent ba301d3 commit efdd5ee

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Auto-assign Devin PRs
2+
3+
on:
4+
pull_request:
5+
types: [opened]
6+
7+
jobs:
8+
assign:
9+
if: github.actor == 'devin-ai-integration[bot]'
10+
runs-on: ubuntu-latest
11+
permissions:
12+
pull-requests: write
13+
issues: write
14+
steps:
15+
- name: Extract and assign requesting user
16+
uses: actions/github-script@v7
17+
with:
18+
script: |
19+
const body = context.payload.pull_request.body || '';
20+
const match = body.match(/Requested by[:\s]*(?:@(\w[\w-]*)|[\w][\w\s]*\(@(\w[\w-]*)\))/);
21+
const user = match?.[1] || match?.[2];
22+
if (user) {
23+
await github.rest.issues.addAssignees({
24+
owner: context.repo.owner,
25+
repo: context.repo.repo,
26+
issue_number: context.issue.number,
27+
assignees: [user]
28+
});
29+
console.log(`Assigned PR #${context.issue.number} to @${user}`);
30+
} else {
31+
console.log('Could not determine requesting user from PR description');
32+
}

0 commit comments

Comments
 (0)