Skip to content

Commit 67a93e0

Browse files
committed
Sync auto-assign-pr.yml from .github repo
1 parent 52db4a3 commit 67a93e0

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Auto Assign Copilot (or any username) to every new pull request.
2+
# Tweak the username(s) below as needed!
3+
4+
name: Auto Assign Copilot to PRs
5+
6+
on:
7+
pull_request:
8+
types: [opened]
9+
10+
jobs:
11+
auto-assign:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Assign Copilot (or others) to new PRs
15+
uses: actions/github-script@main
16+
with:
17+
github-token: ${{ secrets.GITHUB_TOKEN }}
18+
script: |
19+
// Assign PRs to Copilot or other users
20+
const copilotUsername = "copilot"; // <-- TUNE ME!
21+
const assignees = [copilotUsername]; // Or: ["copilot","anotheruser"]
22+
const currentAssignees = context.payload.pull_request.assignees.map(u => u.login);
23+
if (!assignees.every(a => currentAssignees.includes(a))) {
24+
await github.rest.issues.addAssignees({
25+
owner: context.repo.owner,
26+
repo: context.repo.repo,
27+
issue_number: context.payload.pull_request.number,
28+
assignees
29+
});
30+
console.log(`Assigned ${assignees.join(", ")} to PR #${context.payload.pull_request.number}`);
31+
} else {
32+
console.log(`Already assigned: ${assignees.join(", ")} on PR #${context.payload.pull_request.number}`);
33+
}

0 commit comments

Comments
 (0)