-
Notifications
You must be signed in to change notification settings - Fork 27
33 lines (30 loc) · 1.28 KB
/
auto-assign-pr.yml
File metadata and controls
33 lines (30 loc) · 1.28 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
# Auto Assign Copilot (or any username) to every new pull request.
# Tweak the username(s) below as needed!
name: Auto Assign Copilot to PRs
on:
pull_request:
types: [opened]
jobs:
auto-assign:
runs-on: [self-hosted, linux, x64, big]
steps:
- name: Assign Copilot (or others) to new PRs
uses: actions/github-script@main
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
// Assign PRs to Copilot or other users
const copilotUsername = "copilot"; // <-- TUNE ME!
const assignees = [copilotUsername]; // Or: ["copilot","anotheruser"]
const currentAssignees = context.payload.pull_request.assignees.map(u => u.login);
if (!assignees.every(a => currentAssignees.includes(a))) {
await github.rest.issues.addAssignees({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.payload.pull_request.number,
assignees
});
console.log(`Assigned ${assignees.join(", ")} to PR #${context.payload.pull_request.number}`);
} else {
console.log(`Already assigned: ${assignees.join(", ")} on PR #${context.payload.pull_request.number}`);
}