-
Notifications
You must be signed in to change notification settings - Fork 83
40 lines (34 loc) · 1.09 KB
/
auto-assign-pr-author.yml
File metadata and controls
40 lines (34 loc) · 1.09 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
# New BSD 3-Clause License (https://github.com/Krypton-Suite/Standard-Toolkit/blob/master/LICENSE)
# Modifications by Peter Wagner (aka Wagnerp), Simon Coghlan (aka Smurf-IV), tobitege et al. 2025 - 2026. All rights reserved.
name: Auto-assign PR author
on:
pull_request_target:
types:
- opened
permissions:
issues: write
pull-requests: write
jobs:
assign-author:
runs-on: ubuntu-latest
steps:
- name: Assign PR author
uses: actions/github-script@v8
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const { owner, repo } = context.repo;
const pr = context.payload.pull_request;
const branch = pr.head.ref;
let assignee = context.actor;
if (branch.startsWith('dependabot/')) {
assignee = owner;
}
if (!pr.assignees?.length) {
await github.rest.issues.addAssignees({
owner,
repo,
issue_number: pr.number,
assignees: [assignee],
});
}